corrected the  orientation of closed polylines