extract env in tests & deferred memoized_method support