fixed selection sort