clean up and setup for call to cmd_fsm