Sort folders and files. Fix a bug.