Fixed some issues in nntrainer.