Fixed problem with fetching query.