fixes the retrieval of fields value for the query.
Small refactoring.