fix bug with merge reordering rows