Fix some template type functionality