Enable state checker and the mutual exclusion

Enabling state checker revealed bunch of bugs in the mutual exclusion
logic and they are now fixed.