More unit tets for RingBufferIndex and some errors fixed.