fix bug when use RingBuffer with generator
'generator' object is not allowed in memoize