diff --git a/apachesolr.module b/apachesolr.module
index b4e6983..5a6b793 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -2438,6 +2438,11 @@ function theme_apachesolr_settings_title($vars) {
  *   An environment object.
  */
 function apachesolr_ctools_environment_save($environment) {
+  if (!empty($environment->index_bundles)) {
+    foreach ($environment->index_bundles as $type => $bundles) {
+      apachesolr_index_set_bundles($environment->env_id, $type, $bundles);
+    }
+  }
   apachesolr_environment_save((array) $environment);
 }
 
@@ -2471,7 +2476,15 @@ function apachesolr_ctools_environment_export($environment, $indent) {
   // Re-load the enviroment, since in some cases the conf
   // is stripped since it's not in the actual schema.
   $environment = (object) apachesolr_environment_load($environment->env_id);
+
+  $index_bundles = array();
+  foreach (entity_get_info() as $type => $info) {
+    if ($bundles = apachesolr_get_index_bundles($environment->env_id, $type)) {
+      $index_bundles[$type] = $bundles;
+    }
+  }
+
   $additions_top = array();
-  $additions_bottom = array('conf' => $environment->conf);
+  $additions_bottom = array('conf' => $environment->conf, 'index_bundles' => $index_bundles);
   return ctools_export_object('apachesolr_environment', $environment, $indent, NULL, $additions_top, $additions_bottom);
 }
