enhanced select to ensure compatiblity with node-imap