fix query to CAS