fixed an exception triggered when an email fail