attempt to fix rollover issues in circular buffer