bug fixes to mailer