Fix register_template