more robust ringbuf