Fixed logic error when checking for existing files.