Fixed sorting of input files