refactored setFlags in TrainModel