Fix to PolygonizeLines so it works better with 3D data