fix the ring buf bug