Added a check if the file exists.