fix template builds for templates in directories