Fixed a bug with query and sorting quests