handle non-hashable args in memoize with try-except