corrected minor erros in training data function