fixed bug with training data