fix env detection