fix bugs in find_state_by_content