added CheckTemplateDir
Merge branches 'master' and 'refactor'