fixed entity query bug