fixed merging bugs