add some train-and-test utils
fix retraining bug