safe nextMsgLen
added varint variants
test varint write specifically