Fix multidimensional arrays

Several fixes for multidimensional arrays work.