Fixed some template issues