fixes to email thing. hopefully nothing is broken now