Fixing bugs in the simplification of meshes