Added check for undeclared variables in file templates