Fixed problem with sending emails on errors

Fixes #93