Change RingBuffer to have buffer size of 128 and also set its members volatile since they are all accessed and modified in interrupt handlers.
Modifications to make serial transmit interrupt work more reliably. Also, added the availableForWrite function.