Improved null handling in SortedList.toArray