working on ring buffer issue