more amends to email function