Defer context creation until after gettemplateurl check.