Fixed bug in clearPolygons