change method to check the existence of the file