Fixed bug where degenerated polygons were not handled correctly