add maildir check
Minor code tweaks