env detection fix