       if ip.type is 'closeBracket'
         # Bracket closings before data should remove bracket context
         @result.__bracketClosingBefore = [] unless @result.__bracketClosingBefore
-        context = @nodeInstance.bracketContext[@scope].pop()
+        context = @nodeInstance.bracketContext[port][@scope].pop()
         context.closeIp = ip
         @result.__bracketClosingBefore.push context
         continue
       if ip.type is 'openBracket'
         # Bracket openings need to go to bracket context
-        @nodeInstance.bracketContext[@scope].push
+        @nodeInstance.bracketContext[port][@scope].push
           ip: ip
           ports: []
           source: port


  __getForForwarding: (port) ->
    # Ensure we have a bracket context for the current scope
    @nodeInstance.bracketContext[@scope] = [] unless @nodeInstance.bracketContext[@scope]
    prefix = []
    dataIp = null
    # Read IPs until we hit data

          result[port] = [] unless result[port]
          result[port].unshift context.closeIp.clone()

    if result.__bracketContext
      # First see if there are any brackets to forward
      for inport, context of result.__bracketContext
        continue unless context.length
        for outport, ips of result
          continue if outport.indexOf('__') is 0
          unforwarded = context.filter (ctx) =>
            return false unless @isForwardingOutport inport, outport
            ctx.ports.indexOf(outport) is -1
          continue unless unforwarded.length
          unforwarded.reverse()
          for ctx in unforwarded
            ips.unshift ctx.ip.clone()
            debug "#{@nodeId} register #{outport} to #{inport} ctx #{ctx.ip.data}"
            ctx.ports.push outport

    if result.__bracketClosingAfter?.length
      for context in result.__bracketClosingAfter
