corrected some bugs in automaton
Finished porting fw/bw analysis from java