first version dfa
bug fix dfa