 
     @get_datacenter_reachability = (datacenter_uuid) ->
         total = (_.filter machines.models, (m) => m.get('datacenter_uuid') is datacenter_uuid).length
-        reachable = (_.filter directory.models, (m) => machines.get(m.get('id')).get('datacenter_uuid') is datacenter_uuid).length
+        reachable = (_.filter directory.models, (m) =>
+            _m = machines.get(m.get('id'))
+            if _m?
+                _m.get('datacenter_uuid') is datacenter_uuid
+            else
+                return false
+            ).length
 
         if reachable == 0 and total > 0
             for machine in machines.models

    modal_registry = []
register_modal = (modal) -> modal_registry.push(modal)

updateInterval = 500

declare_client_connected = ->
    window.connection_status.set({client_disconnected: false})

    @get_machine_reachability = (machine_uuid) ->
        reachable = directory.get(machine_uuid)?
        if not reachable
            _m = machines.get(machine_uuid)
            if _m?
                last_seen = _m.get('last_seen')
            else
                last_seen = null
            if last_seen
                last_seen = $.timeago(new Date(parseInt(last_seen) * 1000))
        json =
