     }
 
     let key = nativeStorage.assertingGet(nativeIndex).0
-    let start = nativeStorage._bucket(key)
-    nativeDeleteImpl(nativeStorage, start: start, offset: nativeIndex.offset)
+    nativeDeleteImpl(nativeStorage, idealBucket: nativeStorage._bucket(key),
+        offset: nativeIndex.offset)
   }
 
   mutating func removeAtIndex(index: Index) {

      nativeStorage = native
    }
    if capacityChanged {
      start = nativeStorage._bucket(key)
      (index, found) = nativeStorage._find(key, start)
      _sanityCheck(found, "key was lost during storage migration")
    }

    let oldValue = nativeStorage[index.offset]!.value
    nativeDeleteImpl(nativeStorage, start: start, offset: index.offset)
    return oldValue
  }


    }
  }

  /// :param: idealBucket The ideal bucket for the element being deleted.
  /// :param: offset The offset of the element that will be deleted.
  mutating func nativeDeleteImpl(
      nativeStorage: NativeStorage, idealBucket: Int, offset: Int
  ) {
    // remove the element
    nativeStorage[offset] = .None
