works for plain values and arrays. nested arrays broken