Update train.c

Copy from josem