corrected for bug with ellipse, rect polygon width or height being set to zero. still need to improve error reporting