Fixed errors in merging