Fixed up model_fit so that it works.