Fix for dealing with 2D geometries. Closes #471