Fix automaton building