fixed template parsing