Fixed bug. We need to copy elements before we start sorting.