 
 boolean setLocalPort(int localport)
 {
-    if(wifly.getPort() != localport)
+    if(WiFlyLocalPort != localport)
     {
         wifly.setPort(localport);
         wifly.save();
+        WiFlyLocalPort = localport;
         //wifly.reboot();
         //delay(5000);
         

    if (Modem_DCDFollowsRemoteCarrier)
        digitalWriteFast(C64_DCD, Modem_ToggleCarrier(true));

    Modem_isConnected = true;
    Modem_isCommandMode = false;
    Modem_isRinging = false;

            return false;
        }
    }
    else
        return false;
}

int Modem_ToggleCarrier(boolean isHigh)
