fixed compile bug for nested templates (e.g #subtemplate)