Fix afterRender not firing issue with moving from empty template name to a valid template