Fixed error in update of a and b