Fix marshalling of arrays with immutable elements (at least for most cases)