Fix for #122667, as suggested by brrt++