     ViewModel.check "#parent", args...
     viewmodel = this
     parentTemplate = ViewModel.parentTemplate(viewmodel.templateInstance)
-    return parentTemplate.viewmodel
+    return parentTemplate?.viewmodel
 
   reset: ->
     viewmodel = this

      ViewModel.add viewmodel
      templateInstance.viewmodel = viewmodel
      viewmodel.templateInstance = templateInstance

      Tracker.afterFlush ->
        templateInstance.autorun ->
          viewmodel.load Template.currentData()


  load: (obj) ->
    viewmodel = this
    for key, value of obj when key isnt 'share' and key isnt 'mixin' and key isnt 'ref'
      if _.isFunction(value)
        # we don't care, just take the new function
        viewmodel[key] = value
