unify environment handling