State check on test
Fix race condition on state change