The attached patch fixes it for me, but maybe someone with more insight can provide a better solution.