Added check for non-existing template var