run_state_machine more robust to errors