           return unless buf[0] is ip
           # Remove from buffer
           port.get ip.scope
-          context = @bracketContext[ip.scope].pop()
+          context = @bracketContext[port.name][ip.scope].pop()
           context.closeIp = ip
           return unless context.ports.length
           debug "#{@nodeId} closeBracket-C #{ip.data} #{context.ports}"


    # Add current bracket context to the result so that when we send
    # to ports we can also add the surrounding brackets
    @result.__bracketContext = @nodeInstance.bracketContext[@scope].slice 0
    # Bracket closings that were in buffer after the data packet need to
    # be added to result for done() to read them from
    return dataIp

          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
