added better env support