Fix bug in automaton task.