fix memoization