Workaround for bugs #10771 and #6720.