Also fix the createPolygon() function and the corresponding unit test