Fix bug is ring buffer