Fixed bug with ArrayCollection.toArray() method