diff --git a/misc-scripts/repeats/shrink_trfs.pl b/misc-scripts/repeats/shrink_trfs.pl
index e1fefcf04813ff1d67f31ce0b8322a47f1182415..4d36c2c389d3426551981ed6b199d8645e7b9b6d 100644
--- a/misc-scripts/repeats/shrink_trfs.pl
+++ b/misc-scripts/repeats/shrink_trfs.pl
@@ -117,8 +117,8 @@ $db->do( "update repeat_feature rf, tmp_old_new_rcid tonr " .
 
 print STDERR "Repeat_features updated.\n";
 
-$db->do( "delete repeat_consensus " .
-	 "from repeat_consensus rc, tmp_old_new_rcid tonr " .
+$db->do( "delete from rc " .
+	 "using repeat_consensus rc, tmp_old_new_rcid tonr " .
 	 "where rc.repeat_consensus_id = tonr.old_id " );
 
 $db->do( "update repeat_consensus " .