fix for broken circular buffer iteration