Fix function error in env detection