Fixed handling of env