bug fixes in run_model