fixed example of toArray