fixed minor problem in email sending code