Fixing email notification bugs