mail impl and bug fix