fixed the mail() function