fix emailing bug