fixing bug in sending email