encode some fields as varint