Add fail safe mechanism for reloading template

If fail to reload template, use preloaded template instead.