Use template instead of copy_file, for backward compatible.