fix interpolation of last trajectory segment.