optimization to only load env variable if required