small fix to train_model