cleanup before turning on the command state machine