sort files before processing