patch for queries