Fixes to mongos and query handling