fixed sub_event splitting algorithm to do proper least squares fitting