fixing download json after query finishes