Fix overwriting of query.