Fixed ArrayUtil to handle non-arrays