fixed save_model method