Index: src/includes/admin/tools.php
===================================================================
--- src/includes/admin/tools.php	(revision 5368)
+++ src/includes/admin/tools.php	(working copy)
@@ -641,7 +641,7 @@
 	if ( is_wp_error( $wpdb->query( $sql_delete ) ) ) {
  		return array( 1, sprintf( $statement, $result ) );
 	}
- 
+
 	// Recalculate the metas key _bbp_reply_count and _bbp_total_reply_count for each forum
 	$forums = get_posts( array( 'post_type' => bbp_get_forum_post_type(), 'numberposts' => -1 ) );
 	if ( !empty( $forums ) ) {
@@ -1322,6 +1322,10 @@
 	$statement = __( 'Recalculating reply menu order &hellip; %s', 'bbpress' );
 	$result    = __( 'No reply hierachy to recalculate!',          'bbpress' );
 
+	// First, delete _bbp_reply_to to self from post meta.
+	if ( is_wp_error( $wpdb->query( "DELETE FROM `$wpdb->postmeta` WHERE `meta_key` = '_bbp_reply_to' AND `post_id` = `meta_value`;" ) ) )
+		return array( 1, sprintf( $statement, $result ) );
+
 	// Post type
 	$rpt = bbp_get_reply_post_type();
 
@@ -1339,7 +1343,7 @@
 
 	// Bail if no replies returned
 	if ( empty( $replies ) ) {
-		return array( 1, sprintf( $statement, $result ) );
+		return array( 2, sprintf( $statement, $result ) );
 	}
 
 	// Recalculate the menu order position for each reply
Index: src/includes/replies/functions.php
===================================================================
--- src/includes/replies/functions.php	(revision 5368)
+++ src/includes/replies/functions.php	(working copy)
@@ -1119,7 +1119,7 @@
 		return;
 
 	// Set the reply to
-	if ( !empty( $reply_to ) ) {
+	if ( ! empty( $reply_to ) ) {
 		update_post_meta( $reply_id, '_bbp_reply_to', $reply_to );
 
 	// Delete the reply to
@@ -1127,7 +1127,7 @@
 		delete_post_meta( $reply_id, '_bbp_reply_to' );
 	}
 
-	return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_to, $reply_id );
+	return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_id, $reply_to );
 }
 
 /**
