diff --git a/search_api.module b/search_api.module
index 0c2e024..c0f9803 100644
--- a/search_api.module
+++ b/search_api.module
@@ -844,18 +844,29 @@ function search_api_search_api_item_type_info() {
  * Implements hook_modules_enabled().
  */
 function search_api_modules_enabled(array $modules) {
-  // New modules might offer additional entity types, invalidating the cached
-  // item type information.
+  // New modules might offer additional item types and service classes,
+  // invalidating the cached information.
   drupal_static_reset('search_api_get_item_type_info');
+  drupal_static_reset('search_api_get_service_info');
 }
 
 /**
  * Implements hook_modules_disabled().
  */
 function search_api_modules_disabled(array $modules) {
-  // The disabled modules might have offered entity types, which are now
-  // invalid. Therefore, clear the cached item type informaiton.
+  // The disabled modules might have offered item types, which are now
+  // invalid. Therefore, delete all indexes which don't have a valid item type
+  // anymore.
   drupal_static_reset('search_api_get_item_type_info');
+  $types = search_api_get_item_type_info();
+  $indexes = db_query('SELECT id FROM {search_api_index} WHERE item_type NOT IN (:types)', array(':types' => array_keys($types)));
+  entity_delete_multiple('search_api_index', $indexes->fetchCol());
+
+  // The same applies to service classes and servers.
+  drupal_static_reset('search_api_get_service_info');
+  $classes = search_api_get_service_info();
+  $servers = db_query('SELECT id FROM {search_api_server} WHERE class NOT IN (:classes)', array(':classes' => array_keys($classes)));
+  entity_delete_multiple('search_api_server', $servers->fetchCol());
 }
 
 /**
@@ -1480,7 +1491,7 @@ function search_api_get_data_type_info($type = NULL) {
  *
  * @see hook_search_api_service_info()
  *
- * @param $id
+ * @param string|null $id
  *   The ID of the service info to retrieve.
  *
  * @return array
@@ -1507,15 +1518,14 @@ function search_api_get_service_info($id = NULL) {
 /**
  * Returns information for either all item types, or a specific one.
  *
- * @param $type
+ * @param string|null $type
  *   If set, the item type whose information should be returned.
  *
- * @return
+ * @return array|null
  *   If $type is given, either an array containing the information of that item
  *   type, or NULL if it is unknown. Otherwise, an array keyed by type IDs
  *   containing the information for all item types. Item type information is
- *   formatted as specified by hook_search_api_item_type_info(), and has all
- *   optional fields filled with the defaults.
+ *   formatted as specified by hook_search_api_item_type_info().
  *
  * @see hook_search_api_item_type_info()
  */
