Sorry, the previous email was a fat finger error.
Attaching the patch that fixes the issue, although I am not familiar withthe codebase to be sure that it is the right idea.