fixed a bug in email sending