getContractQuery fixed