circular buffer tests and fix