         renderUnit: (path) ->
             parsedPath = @_matchResourceUrl path
             if 'id' of parsedPath
-                @controller.selectUnitById parsedPath.id
+                def = $.Deferred()
+                @controller.renderUnitById(parsedPath.id).done (unit) =>
+                    def.resolve
+                        afterMapInit: => @controller.selectUnit unit
+                def.promise()
             else if parsedPath.filters?.service?
                 @controller.renderUnitsByServices parsedPath.filters.service
 

                unit.fetch
                    data: include: 'department,municipality,services'
                    success: => @selectedUnits.trigger 'reset', @selectedUnits
        selectUnitById: (id) ->
            deferred = $.Deferred()
            unit = @getUnit id
            if unit?
                @selectUnit unit
            else
                unit = new Models.Unit id: id
                unit.fetch
                    data:
                        include: 'department,municipality'
                    success: =>
                        @selectUnit unit
                        deferred.resolve()
            deferred.promise()
        clearSelectedUnit: ->
            @route.clear()

            # the state encoded in the route URL has been
            # reconstructed. The state affects the map
            # centering, zoom, etc.
            callback?.apply(@, args)?.done (opts) ->
                makeMapView()
                opts?.afterMapInit?()

    app.addInitializer (opts) ->

