Fix a bug with email sending