fix multiple encoding in nested templates

okay i've made some little tests regarding my comment at bcosca/fatfree#656.
Maybe you can check that too. If you merge it, it'll also be included in the PR to bcosca (i think so).