use own method for parsing varint from string/stream