Fixed bug in email sending