   createMarkerSnapshot: (activeMarkerLayer) ->
     snapshot = {}
 
-    role = activeMarkerLayer?.getRole()
+    if activeMarkerLayer?
+      activeMarkerLayer = @getMarkerLayer(activeMarkerLayer.id)
+      role = activeMarkerLayer.getRole()
 
     for markerLayerId, markerLayer of @markerLayers when markerLayer.maintainHistory
       if role? and (markerLayer.getRole() is role) and (markerLayer isnt activeMarkerLayer)

  addMarkerLayer: (options) ->
    layer = new MarkerLayer(this, String(@nextMarkerLayerId++), options)
    @markerLayers[layer.id] = layer
    layer

  # Public: Get a {MarkerLayer} by id.

    @markerLayers = {}
    @markerLayers[@defaultMarkerLayer.id] = @defaultMarkerLayer
    @markerLayersWithPendingUpdateEvents = new Set()
    @markerLayerIdsByRole = {}
    @nextMarkerId = 1
    @outstandingSaveCount = 0
    @loadCount = 0
