Make json and csv download from correct environment.