 
         if newtag._browser.insert is true
             that = this
-            oldreplacerequest = newtag._browser.replace.callback?
+            oldreplacerequest = newtag._browser.replace?.callback?
+            newtag._browser.replace ?= new Callback
             newtag._browser.replace.replace(newtag).callback ?= ->
                 return if removed this
                 that.replace_callback(oldtag, this)


    replace_callback: (oldtag, newtag) ->
        @fn.replace(oldtag, newtag)

# exports


class BrowserState
    initialize: (prev) ->
        @parent_done ?= new Callback
        @insert      ?= new Callback
        @manip ?= cancelable_and_retrivable_callbacks()
        @done  ?= deferred_callbacks()
