Added a check for an existing file.