sort file list and fixed a bug of cat