fixed bug in email sending method