fix mail on error exception