Another attempt at making the state transitions more reliable