Fixed some nasty bugs in email services