possibility to send email on error
fix send email on errors
minor fix