fix bug in cubic spline