changed all toArray(...) to toArray()