diff --git a/client/distance/src/lib.rs b/client/distance/src/lib.rs
index ef138ca2cc80f6663ec6e200259fb9fde2730865..19c3fe661bba38bcefde6296da2d0fca01597d91 100644
--- a/client/distance/src/lib.rs
+++ b/client/distance/src/lib.rs
@@ -87,34 +87,33 @@ where
     // Have we already published a result for this period?
     if let Some(results) = published_results {
         // Find the account associated with the BABE key that is in our owner keys.
-        let Some((_key, local_account)) = client
-            .storage_pairs(
-                parent,
-                Some(&StorageKey(
-                    frame_support::storage::storage_prefix(b"Session", b"KeyOwner").to_vec(),
-                )),
-                None,
-            )?
-            .filter_map(|(raw_key, raw_data)| {
-                if &raw_key.0[40..44] == b"babe" {
-                    Some((
-                        sp_core::sr25519::Public::from_raw(
-                            raw_key.0[45..45 + 32].try_into().unwrap(),
-                        ),
-                        AccountId32::decode(&mut &raw_data.0[..]).ok()?,
-                    ))
+        let mut local_account = None;
+        for key in owner_keys {
+            // Session::KeyOwner is StorageMap<_, Twox64Concat, (KeyTypeId, Vec<u8>), AccountId32, OptionQuery>
+            // Slices (variable length) and array (fixed length) are encoded differently, so the `.as_slice()` is needed
+            let item_key = (sp_runtime::KeyTypeId(*b"babe"), key.0.as_slice()).encode();
+            let mut storage_key =
+                frame_support::storage::storage_prefix(b"Session", b"KeyOwner").to_vec();
+            storage_key.extend_from_slice(&sp_core::twox_64(&item_key));
+            storage_key.extend_from_slice(&item_key);
+
+            if let Some(raw_data) = client.storage(parent, &StorageKey(storage_key))? {
+                if let Ok(key_owner) = AccountId32::decode(&mut &raw_data.0[..]) {
+                    local_account = Some(key_owner);
+                    break;
                 } else {
-                    None
+                    log::warn!("🧙 [distance oracle] Cannot decode key owner value");
                 }
-            })
-            .find(|(key, _data)| owner_keys.contains(key))
-        else {
+            }
+        }
+        if let Some(local_account) = local_account {
+            if results.evaluators.contains(&local_account) {
+                log::debug!("🧙 [distance oracle] Already published a result for this period");
+                return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None));
+            }
+        } else {
             log::error!("🧙 [distance oracle] Cannot find our BABE owner key");
             return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None));
-        };
-        if results.evaluators.contains(&local_account) {
-            log::debug!("🧙 [distance oracle] Already published a result for this period");
-            return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None));
         }
     }