improve file checks