train-word finally corrected to handle state