improve sync files method