Fix passing of query