add ringbuffer and test