Apply the patch from PR14160. I failed to construct a testcase for this, but