added assert statements to ensure that the unpacked struct is the same as the original struct