fixed the merging table bugs