Fix sorting errors of previous modification and some more