templates init race fix