Attached a proposed patch to fix the problem.