fix bug with using fabs instead of squared gradient.  will not actually matter here, but will for costs
fix bug with using fabs instead of squared gradient.