improve email handling