Fixed env variable bugs