The size used for packing the string was wrong because it used the original string lenght rather than the encoded.