improve fsm locking