corrects bug in train