bug fix on email sending