diff --git a/scapy/arch/pcapdnet.py b/scapy/arch/pcapdnet.py
index aa8db5494f3c29d207996521c019a00ce458a63b..2493ba43768b95549573d1cea90cad64820ee9d9 100644
--- a/scapy/arch/pcapdnet.py
+++ b/scapy/arch/pcapdnet.py
@@ -152,6 +152,7 @@ if conf.use_winpcapy:
           ts = self.header.contents.ts.tv_sec
           pkt = "".join(chr(i) for i in self.pkt_data[:self.header.contents.len])
           return ts, pkt
+      __next__ = next
       def datalink(self):
           return pcap_datalink(self.pcap)
       def fileno(self):
@@ -368,6 +369,7 @@ if conf.use_pcap:
                         return
                     ts, pkt = c
                     return ts, str(pkt)
+                __next__ = next
             open_pcap = lambda *args,**kargs: _PcapWrapper_pypcap(*args,**kargs)
         elif hasattr(pcap,"pcapObject"): # python-libpcap
             class _PcapWrapper_libpcap:
@@ -382,6 +384,7 @@ if conf.use_pcap:
                         return
                     l,pkt,ts = c 
                     return ts,pkt
+                __next__ = next
                 def __getattr__(self, attr):
                     return getattr(self.pcap, attr)
                 def __del__(self):
@@ -403,6 +406,7 @@ if conf.use_pcap:
                             return
                         s,us = h.getts()
                         return (s+0.000001*us), p
+                __next__ = next
                 def fileno(self):
                     warning("fileno: pcapy API does not permit to get capure file descriptor. Bugs ahead! Press Enter to trigger packet reading")
                     return 0
diff --git a/scapy/automaton.py b/scapy/automaton.py
index 7419aa9151287fc9dd0cb1529cef6917bf976aac..d185fd211d7b938d0592c8a9546fa720bcc5c0fb 100644
--- a/scapy/automaton.py
+++ b/scapy/automaton.py
@@ -11,7 +11,7 @@ from __future__ import absolute_import
 import types,itertools,time,os,sys,socket,traceback
 from select import select
 from collections import deque
-import threading, thread
+import threading
 from scapy.config import conf
 from scapy.utils import do_graph
 from scapy.error import log_interactive
@@ -21,6 +21,13 @@ from scapy.supersocket import SuperSocket
 from scapy.consts import WINDOWS
 import scapy.modules.six as six
 
+try:
+    import thread
+except ImportError:
+    THREAD_EXCEPTION = RuntimeError
+else:
+    THREAD_EXCEPTION = thread.error
+
 """ In Windows, select.select is not available for custom objects. Here's the implementation of scapy to re-create this functionnality
 # Passive way: using no-ressources locks
                +---------+             +---------------+      +-------------------------+
@@ -86,7 +93,7 @@ class SelectableObject:
         self.was_ended = arborted
         try:
             self.trigger.release()
-        except thread.error:
+        except THREAD_EXCEPTION as e:
             pass
 
 class SelectableSelector(object):
@@ -95,7 +102,7 @@ class SelectableSelector(object):
     
     inputs: objects to process
     remain: timeout. If 0, return [].
-    customTypes: types of the objects that have the checkRecv function.
+    customTypes: types of the objects that have the check_recv function.
     """
     results = None
     inputs = None
@@ -160,7 +167,7 @@ def select_objects(inputs, remain):
     
     inputs: objects to process
     remain: timeout. If 0, return [].
-    customTypes: types of the objects that have the checkRecv function.
+    customTypes: types of the objects that have the check_recv function.
     """
     handler = SelectableSelector(inputs, remain)
     return handler.process()
@@ -503,7 +510,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
         def fileno(self):
             return self.rd
         def check_recv(self):
-            return self.rd.checkRecv()
+            return self.rd.check_recv()
         def read(self, n=65535):
             if WINDOWS:
                 return self.rd.recv(n)
@@ -518,7 +525,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
         def send(self, msg):
             return self.write(msg)
 
-    class _IO_mixer:
+    class _IO_mixer(SelectableObject):
         def __init__(self,rd,wr):
             self.rd = rd
             self.wr = wr
@@ -526,12 +533,15 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
             if isinstance(self.rd, int):
                 return self.rd
             return self.rd.fileno()
+        def check_recv(self):
+            return self.rd.check_recv()
         def recv(self, n=None):
             return self.rd.recv(n)
         def read(self, n=None):
             return self.recv(n)
         def send(self, msg):
-            return self.wr.send(msg)
+            self.wr.send(msg)
+            return self.call_release()
         def write(self, msg):
             return self.send(msg)
 
@@ -626,7 +636,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
             elif not isinstance(ioin, types.InstanceType):
                 ioin = self._IO_fdwrapper(ioin,None)
             if ioout is None:
-                ioout = ObjectPipe()
+                ioout = ioin if WINDOWS else ObjectPipe()
             elif not isinstance(ioout, types.InstanceType):
                 ioout = self._IO_fdwrapper(None,ioout)
 
@@ -709,7 +719,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
                     elif c.type == _ATMT_Command.STOP:
                         break
                     while True:
-                        state = iterator.next()
+                        state = next(iterator)
                         if isinstance(state, self.CommandMessage):
                             break
                         elif isinstance(state, self.Breakpoint):
@@ -767,7 +777,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
     
                 # Finally listen and pay attention to timeouts
                 expirations = iter(self.timeout[self.state.state])
-                next_timeout,timeout_func = expirations.next()
+                next_timeout,timeout_func = next(expirations)
                 t0 = time.time()
                 
                 fds = [self.cmdin]
@@ -780,7 +790,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
                     if next_timeout is not None:
                         if next_timeout <= t:
                             self._run_condition(timeout_func, *state_output)
-                            next_timeout,timeout_func = expirations.next()
+                            next_timeout,timeout_func = next(expirations)
                     if next_timeout is None:
                         remain = None
                     else:
@@ -868,6 +878,7 @@ class Automaton(six.with_metaclass(Automaton_metaclass)):
 
     def next(self):
         return self.run(resume = Message(type=_ATMT_Command.NEXT))
+    __next__ = next
 
     def stop(self):
         self.cmdin.send(Message(type=_ATMT_Command.STOP))
diff --git a/scapy/modules/nmap.py b/scapy/modules/nmap.py
index a6017fd9220e9e665450eb9767a8bd90c536392c..2b4162b6561363e70aff1b3def288db90557cac7 100644
--- a/scapy/modules/nmap.py
+++ b/scapy/modules/nmap.py
@@ -54,7 +54,7 @@ None.
         try:
             fdesc = open(conf.nmap_base
                          if self.filename is None else
-                         self.filename)
+                         self.filename, "rb")
         except (IOError, TypeError):
             warning("Cannot open nmap database [%s]" % self.filename)
             self.filename = None
diff --git a/scapy/utils.py b/scapy/utils.py
index efa3698b891ba8847861d6f2af3fb103bd2901d7..a2caf2c904c0c4a00fc862489fa0ece8074d8c67 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -745,6 +745,7 @@ class RawPcapReader(six.with_metaclass(PcapReader_metaclass)):
         if pkt == None:
             raise StopIteration
         return pkt
+    __next__ = next
 
 
     def read_packet(self, size=MTU):
diff --git a/scapy/volatile.py b/scapy/volatile.py
index 8c91759ca2cd487860d9740c76673d15143d1459..f4ae84bc34d3d5db3ff9a472b1579e1eba63e614 100644
--- a/scapy/volatile.py
+++ b/scapy/volatile.py
@@ -66,6 +66,7 @@ class RandomEnumeration:
             self.i = 0
             if not self.forever:
                 raise StopIteration
+    __next__ = next
 
 
 class VolatileValue: