isQuery function of query helper is changed to isNextQuery which checks if next is query or not