This partially reverts 192a9d95 (#19432). Fixes #20305. (cherry picked from commit 74c1ab84) (cherry picked from commit f65dedbb)