Small bugfix to curve smoothing algorithm