fix send email on errors