Fixed env detection