change the order of the file check