fix code for traning