fix #2360 and CreateQuery

Fix #2360 and CreateQuery