fixed some sending mail bugs