Fixed a bug in updating coefficients