email/logging fixes