process polygons correctly, fixes #4