Here is the corrected patch to bug #4749. Previous patch fixed the problem, but for the wrong reason.