moved up setting of env variable