Use bytes instead of bytesWritten/bytesRead

To be compliant with the latest version of varint etc