         .append('g')
         .attr('class', 'key')
         # Add a unique id for SelectionManager.removeDuplicates
-        .attr('id', (d) -> Utils.guid())
+        .call((d) ->
+          d.each (item) ->
+            item._id =  Utils.guid()
+        )
+        # Use the unique id added above for the dom element id
+        .attr('id', (d) -> d._id)
         .on('mousedown', () ->
           # Don't trigger mousedown on linescontainer else
           # it create the selection rectangle


  class Keys
    constructor: (@timeline) ->
      @onKeyUpdated = new Signals.Signal()

    selectNewKey: (data, container) ->

        .call(drag)

      properties.selectAll('.key')

        .attr('class', (d) ->
          cls = 'key'
          # keep selected class
