fix email function