Bug fix send email on error