bug fixed for cubic spline calculation