fixes in ring buffer and other stuff