Fixed a bug in Set::toArray()