Fixed env var handling