Fix serialization of arrays and objects