fix handling of env variables in env