Modified getCheckedState to handle string values correctly