Toggle stm in engine thread