fixed bug in email sending