amend list index error in train.py