Add unregister_template_handler to prevent leaks.