A naso, dovrebbe bastare sostituire ksort con krsort.