adding check to make sure the files exist