fixed env detection