Checking validity of file