I had the same problem. It turned out that the collection array (initialized as collection[100] by default) was causing it when I passed it to the sorts method because it was trying to sort 100 objects and only a few objects actually existed. I changed the tunes program to initialize the array with 1 index, then increase it by one with each CD added. That fixed the problem for me.
-Isaiah.