small changes to check_mail
merged thibaut changes