diff --git a/exit_wrapper.py b/exit_wrapper.py
index <HASH>..<HASH> 100644
--- a/exit_wrapper.py
+++ b/exit_wrapper.py
@@ -87,8 +87,11 @@ class BBLStack(object):
         self._stack_dict[addr] = []
 
     def ret(self, addr):
-        # Return from a function. Remove the corresponding stack
-        del self._stack_dict[addr]
+        if addr in self._stack_dict:
+            # Return from a function. Remove the corresponding stack
+            del self._stack_dict[addr]
+        else:
+            l.warning("Attempting to ret from a non-existing stack frame %s." % addr)
 
     def push(self, func_addr, bbl):
         if func_addr not in self._stack_dict:
A bug fixing to make loop detection more robust.