fixed some bugs with emails