memoized recursion broken