fix check for existing files