fixed error in implementing trainingWeight