Bug fix #10234. Solution suggested by rolf1.