fix comparison of query value for py3. Refs: #2558