Template issue

corrected the logic so that the template is handled correctly