     }
     
     func currentAction() -> Action {
-        if let action = NSUserDefaults.standardUserDefaults().objectForKey(currentNetwork()) as? Int {
+        var network = currentNetwork()
+        if network == "not connected" {
+            network = "Not connected to any network"
+        }
+        if let action = NSUserDefaults.standardUserDefaults().objectForKey(network) as? Int {
             return Action(rawValue: action) ?? Action.DoNothing
         }
         return Action.DoNothing

        return usedNetworks
    }
    
    class func updateActionForNetwork(action: Int, index: Int) {
        WifiManager.networks[index][NetworkKeys.action] = action
        if let ssid = WifiManager.networks[index][NetworkKeys.ssid] as? String {

    // Retrieves network info from the user's preferences, returns only the networks that have been connected to and sorted by date last used
    // Also checks user defaults for the actions associated to that network and adds it as a property to the preferences
    private class func getUsedNetworks() -> [[String: AnyObject]] {
        var usedNetworks: [[String: AnyObject]] = [notConnectedWifiDictionary()]
        let airportPreferences = NSDictionary(contentsOfFile: Paths.airportPreferences) as? [String: AnyObject]
        guard let knownNetworks = airportPreferences?[NetworkKeys.knownNetworks] as? [String: AnyObject] else { return usedNetworks }
        for (_, object) in knownNetworks {
