Fixed some problems with merging