Fix bug in email sending