add rewind to fix ring buffer