Fix beier curve using undefined varibles

The previous code made assumptions there was a previous or next point, even for the first point.  This fix stops fatal JavaScript errors by removing this assumption.