some fixes for sending mails