Improved the file check script