cleanup fsm