fixed bug with internal template resolving