Fix bug in multi-level template dirs.