fixes to merge_batches