Fsm fixes

This pull request fixes #12