Make script word with empty IMAP folders

Script raises Exception when dealing with empty IMAP folders.