See attached patch for a possible fix.