Bug fix for fb_template_match