Make query object immutable for count query