corrected polyline encoder