memoization fix