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