query helper modified