Patches to prevent duplicate email sending.