      AutoPtr<Xapian::Weight::Internal> total_stats(new Xapian::Weight::Internal);
      unserialise_stats(message, *(total_stats.get()));
 -    total_stats->set_bounds_from_db(*db);
-+    total_stats->set_bounds_from_db(*db_);
++    total_stats->set_bounds_from_db(*matchstate_->db);
  
      Xapian::MSet mset;
 -    match.get_mset(first, maxitems, check_at_least, mset, *(total_stats.get()), 0, 0);

-    p = message.c_str();
-    p_end = p + message.size();
+    required_type = MSG_GETMSET;
+
+    release_db(db_);
+}
+
+void

 	if (rare(prev.size() > 255))
 	    prev.resize(255);
 	const string & v = *t;
@@ -276,19 +260,25 @@ RemoteServer::msg_termlist(const string &message)
     }
 
     send_message(REPLY_DONE, string());
