         else
             target.__registeredListeners.push([targetId, type])
 
-        if target._attachedToDocument
+        if !@browserLoading && target._attachedToDocument
             @broadcastEvent('AddEventListener', targetId, type)
 
     EnteredTimer : () ->



    AddEventListener : (event) ->
        return if @browserLoading
        {target, type} = event
        return if !clientEvents[type]


        lastIdx = params.length - 1
        for param, idx in params
            if name == 'PageLoaded'
                str = Util.inspect(param, false, null).replace /[^\}],\n/g, (str) ->
                    str[0]
            else
                str = Util.inspect(param, false, null).replace(/[\n\t]/g, '')
                #str = Util.inspect(param)
            @rpcLog.write(str)
            if idx == lastIdx
