Fix slow file duplication.