bugfix to createPolygon function in boxwrap2d.js