Restore memoize mistakenly removed in 7f412a16d72bad13b