fixed the merging bugs