Fixed logic of arrays.