Fixed up some of the mail code