fixed bug on spline find closest point