revert back toArray logic

reverted back the toArray logic