Fixed problems with geometries when merging