fixed some bugs related to smtp