diff --git a/server/devicemanager.cpp b/server/devicemanager.cpp
index f54faeb..eb3c73a 100644
--- a/server/devicemanager.cpp
+++ b/server/devicemanager.cpp
@@ -27,6 +27,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>
 
 #include <qendian.h>
 
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
 const quint64 kBcastMac = 0xffffffffffffULL;
 
 // FIXME: add lock to protect deviceGroupList_ operations?
@@ -157,7 +160,7 @@ void DeviceManager::receivePacket(PacketBuffer *pktBuf)
     // Skip srcMac - don't care
     offset += 6;
 
-    qDebug("dstMac %llx", dstMac);
+    qDebug("dstMac %012" PRIx64, dstMac);
 
 _eth_type:
     // Extract EthType
diff --git a/server/pcapport.cpp b/server/pcapport.cpp
index a7078e9..642b514 100644
--- a/server/pcapport.cpp
+++ b/server/pcapport.cpp
@@ -915,7 +915,7 @@ PcapPort::PortReceiver::~PortReceiver()
 
 void PcapPort::PortReceiver::run()
 {
-    int flag = PCAP_OPENFLAG_PROMISCUOUS;
+    int flags = PCAP_OPENFLAG_PROMISCUOUS;
     char errbuf[PCAP_ERRBUF_SIZE] = "";
     struct bpf_program bpf;
     const char *capture_filter = "arp or (vlan and arp)";
@@ -923,21 +923,40 @@ void PcapPort::PortReceiver::run()
     
     qDebug("In %s", __PRETTY_FUNCTION__);
 
+#ifdef Q_OS_WIN32
+    flags |= PCAP_OPENFLAG_NOCAPTURE_LOCAL;
+#endif
+
 _retry:
     // FIXME: use 0 timeout value?
-    handle_ = pcap_open_live(device_.toAscii().constData(), 65535, 
-                    flag, 1000 /* ms */, errbuf);
+#ifdef Q_OS_WIN32
+    // NOCAPTURE_LOCAL needs windows only pcap_open()
+    handle_ = pcap_open(qPrintable(device_), 65535, 
+                flags, 1000 /* ms */, NULL, errbuf);
+#else
+    handle_ = pcap_open_live(qPrintable(device_), 65535, 
+                    flags, 1000 /* ms */, errbuf);
+#endif
 
     if (handle_ == NULL)
     {
-        if (flag && QString(errbuf).contains("promiscuous"))
+        if (flags && QString(errbuf).contains("promiscuous"))
         {
             // FIXME: warn user that device emulation will not work
             qDebug("%s:can't set promiscuous mode, trying non-promisc", 
-                    device_.toAscii().constData());
-            flag = 0;
+                    qPrintable(device_));
+            flags &= ~PCAP_OPENFLAG_PROMISCUOUS;
             goto _retry;
         }
+#ifdef Q_OS_WIN32
+        else if ((flags & PCAP_OPENFLAG_NOCAPTURE_LOCAL) 
+                && QString(errbuf).contains("loopback"))
+        {
+            qDebug("Can't set no local capture mode %s", qPrintable(device_));
+            flags &= ~PCAP_OPENFLAG_NOCAPTURE_LOCAL;
+            goto _retry;
+        }
+#endif
         else
         {
             // FIXME: warn user that device emulation will not work