fix length detection in read_pdu