Fixing email functions