Fix serialization of polygons