Fix warnings. Add automaton for prefix function