Here is a patch which fixes the problem.