Bugfixes in mail system