fixed write of longs into ringbuffer