apply same concept to train()