diff --git a/scapy/arch/windows/__init__.py b/scapy/arch/windows/__init__.py
index 17ff5238f3ebc989cfbeb79024b7c863f64ef187..40a7299e6c9068154b763b3f219960616b4c7450 100755
--- a/scapy/arch/windows/__init__.py
+++ b/scapy/arch/windows/__init__.py
@@ -1,6 +1,7 @@
 ## This file is part of Scapy
 ## See http://www.secdev.org/projects/scapy for more informations
 ## Copyright (C) Philippe Biondi <phil@secdev.org>
+## Copyright (C) Gabriel Potter <gabriel@potter.fr>
 ## This program is published under a GPLv2 license
 
 """
diff --git a/scapy/automaton.py b/scapy/automaton.py
index e2d0589c4b1824f6cb3b4021878bd02bbf4938f0..49eaec066a83f21b97bdf846ecd7853e68b62d46 100644
--- a/scapy/automaton.py
+++ b/scapy/automaton.py
@@ -1,6 +1,7 @@
 ## This file is part of Scapy
 ## See http://www.secdev.org/projects/scapy for more informations
 ## Copyright (C) Philippe Biondi <phil@secdev.org>
+## Copyright (C) Gabriel Potter <gabriel@potter.fr>
 ## This program is published under a GPLv2 license
 
 """
diff --git a/scapy/fields.py b/scapy/fields.py
index 303d44698b024da61e1e7341d7f30c4b60eb3f5f..e65e092ef70b123a71186844b77d99d7a16e8855 100644
--- a/scapy/fields.py
+++ b/scapy/fields.py
@@ -694,7 +694,7 @@ class FieldListField(Field):
             return len(val)
         return 1
     def i2len(self, pkt, val):
-        return sum( self.field.i2len(pkt,v) for v in val )
+        return int(sum(self.field.i2len(pkt,v) for v in val))
 
     def i2m(self, pkt, val):
         if val is None:
diff --git a/scapy/layers/dhcp.py b/scapy/layers/dhcp.py
index 343ef37bc3c85bbf1fd320123740180004bdb31e..f9940204a21c534128753279b4d0cdc50b211036 100644
--- a/scapy/layers/dhcp.py
+++ b/scapy/layers/dhcp.py
@@ -183,8 +183,6 @@ class RandDHCPOptions(RandField):
             else:
                 op.append((o.name, o.randval()._fix()))
         return op
-    def __bytes__(self):
-        return raw(self._fix())
 
 
 class DHCPOptionsField(StrField):
@@ -218,7 +216,7 @@ class DHCPOptionsField(StrField):
                 opt.append("pad")
                 x = x[1:]
                 continue
-            if len(x) < 2 or len(x) < ord(x[1])+2:
+            if len(x) < 2 or len(x) < orb(x[1])+2:
                 opt.append(x)
                 break
             elif o in DHCPOptions:
@@ -244,7 +242,7 @@ class DHCPOptionsField(StrField):
                     opt.append(otuple)
                     x = x[olen+2:]
             else:
-                olen = ord(x[1])
+                olen = orb(x[1])
                 opt.append((o, x[2:olen+2]))
                 x = x[olen+2:]
         return opt
@@ -274,7 +272,7 @@ class DHCPOptionsField(StrField):
 
             elif (isinstance(o, str) and o in DHCPRevOptions and 
                   DHCPRevOptions[o][1] == None):
-                s += raw(DHCPRevOptions[o][0])
+                s += chb(DHCPRevOptions[o][0])
             elif isinstance(o, int):
                 s += chb(o)+b"\0"
             elif isinstance(o, (str, bytes)):
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
index 4819de70981f368e9900e410fc438c9a6e4c088e..f7dad10c185b829c96a4950ede432e38e4843a6d 100644
--- a/scapy/layers/inet6.py
+++ b/scapy/layers/inet6.py
@@ -2993,7 +2993,7 @@ class MIP6MH_CoTI(MIP6MH_HoTI):
     name = "IPv6 Mobility Header - Care-of Test Init"
     mhtype = 2
     def hashret(self):
-        return self.cookie
+        return raw(self.cookie)
 
 class MIP6MH_HoT(_MobilityHeader):
     name = "IPv6 Mobility Header - Home Test"
@@ -3010,7 +3010,7 @@ class MIP6MH_HoT(_MobilityHeader):
                                           length_from = lambda pkt: 8*(pkt.len-2)) ]
     overload_fields = { IPv6: { "nh": 135 } }
     def hashret(self):
-        return self.cookie
+        return raw(self.cookie)
     def answers(self, other):
         if (isinstance(other, MIP6MH_HoTI) and
             self.cookie == other.cookie):
@@ -3021,7 +3021,7 @@ class MIP6MH_CoT(MIP6MH_HoT):
     name = "IPv6 Mobility Header - Care-of Test"
     mhtype = 4
     def hashret(self):
-        return self.cookie
+        return raw(self.cookie)
 
     def answers(self):
         if (isinstance(other, MIP6MH_CoTI) and
@@ -3139,7 +3139,7 @@ class  AS_resolver6(AS_resolver_riswhois):
 
         _, asn, desc = AS_resolver_riswhois._resolve_one(self, addr)
 
-        if asn.startswith(b"AS"):
+        if asn.startswith("AS"):
             try:
                 asn = int(asn[2:])
             except ValueError:
diff --git a/scapy/utils.py b/scapy/utils.py
index 21de58da475027e2cbacb5b845cac52790287f47..a6b1b8df6b82409696620376cfbc7d140fb90510 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -459,7 +459,9 @@ class ContextManagerCaptureOutput(object):
     def __exit__(self, *exc):
         sys.stdout = self.bck_stdout
         return False
-    def get_output(self):
+    def get_output(self, eval_bytes=False):
+        if self.result_export_object.startswith("b'") and eval_bytes:
+            return plain_str(eval(self.result_export_object))
         return self.result_export_object
 
 def do_graph(graph,prog=None,format=None,target=None,type=None,string=None,options=None):
diff --git a/scapy/volatile.py b/scapy/volatile.py
index 397ad76e09700b9c79f518d3dc1a8771f7411715..7e108888b4581efc68e024d9edb3f3284a775942 100644
--- a/scapy/volatile.py
+++ b/scapy/volatile.py
@@ -89,6 +89,7 @@ class VolatileValue:
         return raw(self._fix())
     def __len__(self):
         return len(self._fix())
+
     def _fix(self):
         return None
 
@@ -110,25 +111,31 @@ class RandNum(RandField):
         return int(self._fix())
     def __index__(self):
         return int(self)
-
-    def __str__(self):
-        return str(self._fix())
-
-class RandNumGamma(RandField):
+    def __add__(self, other):
+        return self._fix() + other
+    def __sub__(self, other):
+        return self._fix() - other
+    def __mul__(self, other):
+        return self._fix() * other
+    def __floordiv__(self, other):
+        return self._fix() / other
+    __div__ = __floordiv__
+
+class RandNumGamma(RandNum):
     def __init__(self, alpha, beta):
         self.alpha = alpha
         self.beta = beta
     def _fix(self):
         return int(round(random.gammavariate(self.alpha, self.beta)))
 
-class RandNumGauss(RandField):
+class RandNumGauss(RandNum):
     def __init__(self, mu, sigma):
         self.mu = mu
         self.sigma = sigma
     def _fix(self):
         return int(round(random.gauss(self.mu, self.sigma)))
 
-class RandNumExpo(RandField):
+class RandNumExpo(RandNum):
     def __init__(self, lambd, base=0):
         self.lambd = lambd
         self.base = base
@@ -234,6 +241,8 @@ class RandString(RandField):
         for _ in range(self.size):
             s += random.choice(self.chars)
         return s
+    def __mul__(self, n):
+        return self._fix()*n
 
 class RandBin(RandString):
     def __init__(self, size=None):
diff --git a/test/pipetool.uts b/test/pipetool.uts
index 15b00e40637ac1219bcf89bc38c6cf11665b98ca..df106625f230830dbf5ddfc61fc58f2ac5d2d09f 100644
--- a/test/pipetool.uts
+++ b/test/pipetool.uts
@@ -263,7 +263,6 @@ os.unlink("t2.pcap")
 
 = Test InjectSink and Inject3Sink
 ~ needs_root
-import mock
 
 import mock
 
diff --git a/test/regression.uts b/test/regression.uts
index 48b8382d36b63411847ebfa4f9e386038992a41c..063abb12e6706bb013c41db49628622f8a092a69 100644
--- a/test/regression.uts
+++ b/test/regression.uts
@@ -275,8 +275,8 @@ import mock
 def test_export_import_object():
     with ContextManagerCaptureOutput() as cmco:
         export_object(2807)
-        result_export_object = cmco.get_output()
-    assert(result_export_object.endswith(b"eNprYPL9zqUHAAdrAf8=\n\n"))
+        result_export_object = cmco.get_output(eval_bytes=True)
+    assert(result_export_object.startswith("eNprYPL9zqUHAAdrAf8=\n"))
     assert(import_object(result_export_object) == 2807)
 
 test_export_import_object()
@@ -5368,7 +5368,7 @@ assert value == 'abcdefg'
 = fragment()
 payloadlen, fragsize = 100, 8
 assert fragsize % 8 == 0
-fragcount = (payloadlen / fragsize) + bool(payloadlen % fragsize)
+fragcount = (payloadlen // fragsize) + bool(payloadlen % fragsize)
 * create the packet
 pkt = IP() / ("X" * payloadlen)
 * create the fragments
@@ -5399,7 +5399,7 @@ assert ffrags[-1].flags == 0
 * fragment offset should be well computed
 plen = 0
 for p in ffrags:
-    assert p.frag == plen / 8
+    assert p.frag == plen // 8
     plen += len(p.payload)
 
 assert plen == payloadlen
@@ -5447,7 +5447,7 @@ assert plist_def[0][DNSRR].rrname == 'nyc.gov.'
 = Packet().fragment()
 payloadlen, fragsize = 100, 8
 assert fragsize % 8 == 0
-fragcount = (payloadlen / fragsize) + bool(payloadlen % fragsize)
+fragcount = (payloadlen // fragsize) + bool(payloadlen % fragsize)
 * create the packet
 pkt = IP() / ("X" * payloadlen)
 * create the fragments
@@ -8171,7 +8171,7 @@ assert(rek == 'b')
 = RandSingNum
 ~ not_pypy
 random.seed(0x2807)
-rs = RandSingNum(-28, 07)
+rs = RandSingNum(-28, 7)
 assert(rs == 3)
 assert(rs == -27)
 
@@ -8577,7 +8577,7 @@ BOOTP().hashret() == b"\x00\x00\x00\x00"
 
 import random
 random.seed(0x2807)
-raw(RandDHCPOptions()) == "[('WWW_server', '90.219.239.175')]"
+str(RandDHCPOptions()) == "[('WWW_server', '90.219.239.175')]"
 
 value = ("hostname", "scapy")
 dof = DHCPOptionsField("options", value)
@@ -8586,14 +8586,14 @@ dof.i2m("", value) == b'\x0cscapy'
 
 unknown_value_end = b"\xfe" + b"\xff"*257
 udof = DHCPOptionsField("options", unknown_value_end)
-udof.m2i("", unknown_value_end) == [(254, '\xff'*255), 'end']
+udof.m2i("", unknown_value_end) == [(254, b'\xff'*255), 'end']
 
 unknown_value_pad = b"\xfe" + b"\xff"*256 + b"\x00"
 udof = DHCPOptionsField("options", unknown_value_pad)
-udof.m2i("", unknown_value_pad) == [(254, '\xff'*255), 'pad']
+udof.m2i("", unknown_value_pad) == [(254, b'\xff'*255), 'pad']
 
 = DHCP - build
-s = raw(IP()/UDP()/BOOTP(chaddr="00:01:02:03:04:05")/DHCP(options=[("message-type","discover"),"end"]))
+s = raw(IP(src="127.0.0.1")/UDP()/BOOTP(chaddr="00:01:02:03:04:05")/DHCP(options=[("message-type","discover"),"end"]))
 s == b'E\x00\x01\x10\x00\x01\x00\x00@\x11{\xda\x7f\x00\x00\x01\x7f\x00\x00\x01\x00C\x00D\x00\xfcf\xea\x01\x01\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0000:01:02:03:04:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x01\xff'
 
 = DHCP - dissection