better env detection