Geometry related bug fixes