Fixing ring buffer wrap around. I think.