Re-fix the query bug