Various bugfixes in dfa code.