BufferManager.say "Connecting to IMAP server #{host}..." do 
       ::Thread.new do
         begin
-          raise Net::IMAP::ByeResponseError, "simulated imap failure"
+          #raise Net::IMAP::ByeResponseError, "simulated imap failure"
           @imap = Net::IMAP.new host, ssl? ? 993 : 143, ssl?
           @imap.authenticate 'LOGIN', @username, @password
           @imap.examine mailbox
 
   end
 
   def num_results_for opts={}
-    with(@index.search(build_query(opts)).total_hits) { |x| Redwood::log "num_results_for: have #{x} for query #{query}" }
+    with(build_query(opts)) { |query| with(@index.search(query).total_hits) { |x| Redwood::log "num_results_for: have #{x} for query #{query}" } }
   end
 
   ## yield all messages in the thread containing 'm' by repeatedly