bugfixing in mail agent