fixed problem in the match index sort