Fixes #274: Template recursion, fix base templates