Patch to fix the queries