Fixed a bug that causes crashing with duplicate geometry, using a sanity check