This partially reverts 25de7aa7. Fixes #14473. (cherry picked from commit 7a182f10) (cherry picked from commit 65d247af)