fix array serialization in certain cases