fix context switch guard