Fixed a small bug in fit_model