fix query matching