fix bugs of the model