fixed strand in getAdjacentQueries function