fixed a bug with NN training