fix interpolation of last segment.