Bug fix: error when there are multiple template keywords in one line.
Add fail safe mechanism: if fail to reload template, use preloaded template instead.