fixed a bug with email sending