Reapplying the #19643 patch sent by BerislavLopac.