polynomial fit bug fix