Try to call toArray() when expecting an array.