bug fixing for mail delivery