update testcase automaton and fix some bugs.TO #2