fix offline template logic