     if candidate.indexOf("a=") != 0
       candidate = "a=" + candidate
 
-    @streams[id]?.nice?.addRemoteIceCandidate candidate
+    @streams[index]?.nice?.addRemoteIceCandidate candidate
 
   close: () ->
     console.log 'closing echo'


        stream = {
          id: id
          index: index
          nice: nice_stream
          needs_ice_cred: true
        }

        @streams[m[1]] = stream

        # send candidates when gathered
        # TODO: move to trickling ...


        rtp_types = rtp_types.concat(parseInt(type) for type in types.split(" "))

      else if m = line.match(/a=mid:(.*)/)
        stream.mid = m[1]

      else if m = line.match(/a=ice-ufrag:(.*)/)
        # replace and apply ufrag
        stream.ufrag = m[1]
