solved the sorting issue for SelectedCMD