Fixed issue with sending emails