Fixed previously introduced scoping error by changing the env cache.