Sorted fix

fixes issues pointed out @rixner

sorry about this. I was a bit too focused on implementing timsort.