fixed minor leastsq bug