More template parsing fixes.