fix checkbounds in ringbuffer
add more ringbuffer tests