Fix query handling (avoid bad type: SRW_query)