Change order of variable definition because JSON.load sometimes failed with invalid response