Fixed Merges Bug in ReplacingMergeTree Tables

Fixed a bug in merges for ReplacingMergeTree tables.