fix ranksort segfault