more robust object/array serialization