diff --git a/ripe/atlas/sagan/helpers/abuf.py b/ripe/atlas/sagan/helpers/abuf.py
index <HASH>..<HASH> 100644
--- a/ripe/atlas/sagan/helpers/abuf.py
+++ b/ripe/atlas/sagan/helpers/abuf.py
@@ -290,12 +290,14 @@ class AbufParser(object):
             edns0 = {
                 'UDPsize':            res[1],
                 'ExtendedReturnCode': res[2] >> 24,
-                'Version':            (res[2] and 0x0f00) >> 16,
-                'Z':                  (res[2] and 0x00ff),
+                'Version':            (res[2] & 0x00ff0000) >> 16,
+                'Z':                  (res[2] & 0x007fff),
                 'Type':               'OPT',
                 'Option':             [],
                 'Name':               name,
             }
+            if res[2] & 0x8000:
+                edns0['DO']= True
 
             o = 0
             while o < len(rdata):
Fixed some bugs in EDNS0 parsing and extract DO flag.