Fix serializing strings bigger than 64KB