Fix bug with circular buffer resizing