fixed bug in createPolygon function: createPolygon used deprecated PolyDef class