handle nested arrays better