Cleaning up bad geometry