Partially revert e45df51a0d1b3b37e6d15c6f5cdf861e5c504de8.

Fixes bug #21214.