Fixed merging bugs