Added writing inside arrays with writeVariable