Fix the broken check state logic

(CherryPick Edit)
Merge pull request #13754 from makinacorpus/state

Fix the broken check state logic