fix K N sort