off by one error on transition in modified fsm