Fix bug causing tpl files with two templates right next together to crash the tool