fixed a bug in updating the parameters