         if Tracker.active then Tracker.onInvalidate => @stop()
 
         @_valueComp = null
-        if @onChange? then Tracker.afterFlush =>
-            if not @_valueComp? then @_setupValueComp()
+        if @onChange? then Tracker.afterFlush Meteor.bindEnvironment =>
+            if not @_valueComp?
+                @_setupValueComp()
 
         @_arrIndexOfDeps = {} # value: dep
 

    set: ->
        throw new Meteor.Error "There is no AutoVar.set"

    stop: ->
        if @active
            @active = false

                    @_arrIndexOfDeps[i]?.changed()


        if _.isFunction @onChange
             if not @equalsFunc oldValue, newValue
                Tracker.afterFlush Meteor.bindEnvironment =>
                    @onChange.call @, oldValue, newValue

    _setupValueComp: ->
        @_valueComp?.stop()
        @_valueComp = Tracker.nonreactive =>
            Tracker.autorun Meteor.bindEnvironment (valueComp) =>
                pos = @constructor._pending.indexOf @
                if pos >= 0
                    @constructor._pending.splice pos, 1

                @_recompute()
                valueComp.onInvalidate =>
                    unless valueComp.stopped
                        if @ not in @constructor._pending
                            @constructor._pending.push @

    contains: (x) ->
        # Reactive
