Minor fixes to email system