Added check on file exists