tlv: fix signedness of some variables