Fixed selection sort issue