Fixes to email sending