The attached patch fixes this bug.