diff --git a/configure.in b/configure.in
index cf47722a809132c1242aef3d5b3fe9de48375d79..155377a13934583bb90ece1e81fb5fbf0dbbd427 100644
--- a/configure.in
+++ b/configure.in
@@ -430,6 +430,9 @@ AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
 
+dnl
+dnl Check for module support
+dnl
 ol_link_modules=no
 if test $ol_enable_modules != no ; then
 	AC_PATH_PROG(GLIBCONFIG, glib-config)
diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c
index 4f743c473c16a9352ff905dec096e9d108c0e36c..1b8d49bbcaa2eeae0c6676f3684d9d8dc5da56d3 100644
--- a/servers/slapd/back-ldbm/modrdn.c
+++ b/servers/slapd/back-ldbm/modrdn.c
@@ -175,13 +175,11 @@ ldbm_back_modrdn(
 		       "ldbm_back_modrdn: no parent, locked root\n",
 		       0, 0, 0 );
 
-	}/* if ( (p_ndn = dn_parent( be, e->e_ndn )) != NULL ) else */
+	}
 
 	new_parent_dn = p_dn;	/* New Parent unless newSuperior given */
 
 	if ( (np_dn = newSuperior) != NULL) {
-
-
 		Debug( LDAP_DEBUG_TRACE, 
 		       "ldbm_back_modrdn: new parent requested...\n",
 		       0, 0, 0 );
@@ -189,9 +187,7 @@ ldbm_back_modrdn(
 		np_ndn = dn_normalize_case( ch_strdup( np_dn ) );
 
 		/* newSuperior == oldParent?, if so ==> ERROR */
-
 		/* newSuperior == entry being moved?, if so ==> ERROR */
-
 		/* Get Entry with dn=newSuperior. Does newSuperior exist? */
 
 		if( (np = dn2entry_w( be, np_ndn, &matched )) == NULL) {
@@ -416,13 +412,9 @@ ldbm_back_modrdn(
 			Debug( LDAP_DEBUG_TRACE,
 			       "ldbm_back_modrdn: removing old_rdn_val=%s\n",
 			       old_rdn_val, 0, 0 );
-		
-		}/* if (deleteoldrdn) */
-
+		}
 	
 	} else {
-	    
-
 		Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DNS DN\n",
 		       0, 0, 0 );
 		/* XXXV3: not sure of what to do here */
@@ -466,6 +458,7 @@ ldbm_back_modrdn(
 return_results:
 	if( new_dn != NULL ) free( new_dn );
 	if( new_ndn != NULL ) free( new_ndn );
+
 return_results_after:
 	/* NOTE:
 	 * new_dn and new_ndn are not deallocated because they are used by
@@ -488,6 +481,11 @@ return_results_after:
 	if ( np_dn != NULL ) free( np_dn );
 	if ( np_ndn != NULL ) free( np_ndn );
 
+	if( np != NULL ) {
+		/* free new parent and writer lock */
+		cache_return_entry_w( &li->li_cache, np );
+	}
+
 	if( p != NULL ) {
 		/* free parent and writer lock */
 		cache_return_entry_w( &li->li_cache, p );