Fixing issues with the vertex merge functions