fixed bug about middle pointers in circular buffer