Fix bug that stops doctests running for @memoized functions