Fix overwrite prevention in circular buffer.