Fix STI scopes using benolee's suggestion. Fixes #11939
Merge pull request #12084 from Ben-M/3-2-stable

Fix STI scopes using benolee's suggestion. Fixes #11939