Add copy_template_files(), fix logic in PebBaseController.