diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c
index 8ec4b6bc560d986f55da910bf946593e48a0ba80..65d0e4bf4bc50e3442e68187b519d1f8f71effaa 100644
--- a/servers/slapd/backover.c
+++ b/servers/slapd/backover.c
@@ -665,8 +665,14 @@ int overlay_op_walk(
 	if ( rc == SLAP_CB_BYPASS )
 		rc = SLAP_CB_CONTINUE;
 
+	/* if an overlay halted processing, make sure
+	 * any previously set cleanup handlers are run
+	 */
+	if ( rc != SLAP_CB_CONTINUE )
+		goto cleanup;
+
 	func = &oi->oi_orig->bi_op_bind;
-	if ( func[which] && rc == SLAP_CB_CONTINUE ) {
+	if ( func[which] ) {
 		op->o_bd->bd_info = oi->oi_orig;
 		rc = func[which]( op, rs );
 	}
@@ -680,6 +686,7 @@ int overlay_op_walk(
 	 */
 	if ( rc == LDAP_UNWILLING_TO_PERFORM ) {
 		slap_callback *sc_next;
+cleanup:
 		for ( ; op->o_callback && op->o_callback->sc_response !=
 			over_back_response; op->o_callback = sc_next ) {
 			sc_next = op->o_callback->sc_next;
diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index 836adf1ed65fc9e0a9d422bd5ded595a92c4fec0..caab9f58eda15c181bf800949bd48640446470c1 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -2055,8 +2055,11 @@ syncrepl_op_modify( Operation *op, SlapReply *rs )
 		overlay_entry_release_ov( op, e, 0, on );
 	}
 	/* equal? Should never happen */
-	if ( match == 0 )
+	if ( match == 0 ) {
+		/* tell accesslog this was a failure */
+		rs->sr_err = LDAP_TYPE_OR_VALUE_EXISTS;
 		return LDAP_SUCCESS;
+	}
 
 	/* mod is older: resolve conflicts...
 	 * 1. Save/copy original modlist. Split Replace to Del/Add.