fixed email sending bug