add functions
correct some bugs on queries for arrays and objetcs