issue #19045: Fix state and other duplicate check problems.
Merge branch '19045' into 20212
Tweak.