change cheking the status for simpler way
Merge pull request #5109 from ticoann/improve_state_search

change cheking the status for simpler way