diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py
index d3ba5b6bb4df0cc312ce150b72919352a7b1c04f..02b55fe7df28a3596afb82969ddf9f0b77d9628a 100644
--- a/inventory_provider/tasks/worker.py
+++ b/inventory_provider/tasks/worker.py
@@ -760,8 +760,8 @@ def ims_task(self, use_current=False):
         transformed_data = transform_ims_data(extracted_data)
 
         persist_ims_data(transformed_data, use_current)
-    except Exception as e:
-        logger.error(e)
+    except Exception:
+        logger.exception('Error in IMS task:')
         update_latch_status(InventoryTask.config, pending=True, failure=True)
 
 
@@ -1014,7 +1014,9 @@ def transform_ims_data(data):
         return int(value) * conversions[unit]
 
     def _get_speed(circuit_id):
-        c = hierarchy[circuit_id]
+        c = hierarchy.get(circuit_id)
+        if c is None:
+            return 0
         if c['status'] != 'operational':
             return 0
         pattern = re.compile(r'^(\d+)([a-zA-z]+)$')