fixed automaton backtracking