Fix linearization of cubic splines.

This addresses a problem that appeared in #1785.