Correctly clear Curve length cache when segments change.

Closes #497