diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc
index d112180..bbab25b 100644
--- a/core/modules/book/book.admin.inc
+++ b/core/modules/book/book.admin.inc
@@ -93,7 +93,8 @@ function book_admin_settings_validate($form, &$form_state) {
  */
 function book_admin_settings_submit($form, &$form_state) {
   config('book.settings')
-    ->set('allowed_types', $form_state['values']['book_allowed_types'])
+    // Remove unchecked types.
+    ->set('allowed_types', array_filter($form_state['values']['book_allowed_types']))
     ->set('child_type', $form_state['values']['book_child_type'])
     ->save();
  }
diff --git a/core/modules/book/book.install b/core/modules/book/book.install
index 797902a..700421e 100644
--- a/core/modules/book/book.install
+++ b/core/modules/book/book.install
@@ -94,8 +94,24 @@ function book_schema() {
  */
 function book_update_8000() {
   update_variables_to_config('book.settings', array(
-    'book_allowed_types' => 'allowed_types',
     'book_child_type' => 'child_type',
     'book_block_mode' => 'block.navigation.mode',
   ));
+  $allowed_types = update_variable_get('book_allowed_types', FALSE);
+  if ($allowed_types) {
+    // In Drupal 7 the variable book_allowed_types was stored like this:
+    // array(
+    //   0 => 'book',
+    //   1 => 'article',
+    // )
+    // In Drupal 8 book.settings:allowed_types should be stored like this:
+    // array(
+    //   'book' => 'book',
+    //   'article' => 'article',
+    // )
+    config('book.settings')
+      ->set('allowed_types', drupal_map_assoc($allowed_types))
+      ->save();
+  }
+
 }
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index a2eae8e..6bdeb2c 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -1232,7 +1232,8 @@ function template_preprocess_book_node_export_html(&$variables) {
  *   A Boolean TRUE if the node type can be included in books; otherwise, FALSE.
  */
 function book_type_is_allowed($type) {
-  return in_array($type, config('book.settings')->get('allowed_types'));
+  $allowed_types = config('book.settings')->get('allowed_types');
+  return isset($allowed_types[$type]);
 }
 
 /**
@@ -1246,11 +1247,12 @@ function book_node_type_update($type) {
     $config = config('book.settings');
     // Update the list of node types that are allowed to be added to books.
     $allowed_types = $config->get('allowed_types');
-    $key = array_search($type->old_type, $allowed_types);
 
-    if ($key !== FALSE) {
-      $allowed_types[$type->type] = $allowed_types[$key] ? $type->type : 0;
-      unset($allowed_types[$key]);
+    if (isset($allowed_types[$type->old_type])) {
+      // Replace the old machine-readable name with the new machine-readable
+      // name.
+      $allowed_types[$type->type] = $type->type;
+      unset($allowed_types[$type->old_type]);
       $config->set('allowed_types', $allowed_types);
     }
 
diff --git a/core/modules/book/config/book.settings.yml b/core/modules/book/config/book.settings.yml
index b61c415..6a57d5d 100644
--- a/core/modules/book/config/book.settings.yml
+++ b/core/modules/book/config/book.settings.yml
@@ -1,6 +1,6 @@
 allowed_types:
-  - book
+  book: book
 block:
   navigation:
-    mode: all pages
+    mode: 'all pages'
 child_type: book
diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
index 2bc08b8..376743d 100644
--- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php
+++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
@@ -67,7 +67,7 @@ function setUp() {
     // Create users.
     $this->book_author = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books'));
     $this->web_user = $this->drupalCreateUser(array('access printer-friendly version', 'node test view'));
-    $this->admin_user = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view'));
+    $this->admin_user = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types'));
   }
 
   /**
@@ -388,5 +388,23 @@ function testBookDelete() {
      $node = node_load($this->book->nid, TRUE);
      $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
    }
+
+  /*
+   * Tests node type changing machine name when type is a book allowed type.
+   */
+  function testBookNodeTypeChange() {
+    $this->drupalLogin($this->admin_user);
+    // Change the name, machine name and description.
+    $edit = array(
+      'name' => 'Bar',
+      'type' => 'bar',
+    );
+    $this->drupalPost('admin/structure/types/manage/book', $edit, t('Save content type'));
+
+    // Ensure that the config book.settings:allowed_types has been updated with
+    // the new machine and the old one has been removed.
+    $this->assertTrue(book_type_is_allowed('bar'), 'Config book.settings:allowed_types contains the updated node type machine name "bar".');
+    $this->assertFalse(book_type_is_allowed('book'), 'Config book.settings:allowed_types does not contain the old node type machine name "book".');
+  }
 }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php
index d2cde1f..7d0d29f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php
@@ -139,6 +139,20 @@ public function testVariableUpgrade() {
       'screenshot' => 'public://color/seven-09696463/dummy-screenshot.png',
     );
 
+    $expected_config['book.settings'] = array(
+      'allowed_types' => array(
+        'book' => 'book',
+        // Content type does not have to exist.
+        'test' => 'test',
+      ),
+      'block' => array(
+        'navigation' => array(
+          'mode' => 'all pages'
+        )
+      ),
+      'child_type' => 'book',
+    );
+
     foreach ($expected_config as $file => $values) {
       $config = config($file);
       $this->verbose(print_r($config->get(), TRUE));
diff --git a/core/modules/system/tests/upgrade/drupal-7.system.database.php b/core/modules/system/tests/upgrade/drupal-7.system.database.php
index 44fad9f..be9f54c 100644
--- a/core/modules/system/tests/upgrade/drupal-7.system.database.php
+++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php
@@ -133,6 +133,10 @@
   ->fields(array('value' => 's:10:"plain_text";'))
   ->condition('name', 'filter_fallback_format')
   ->execute();
+db_update('variable')
+  ->fields(array('value' => 'a:2:{i:0;s:4:"book";i:1;s:4:"test";}'))
+  ->condition('name', 'book_allowed_types')
+  ->execute();
 
 // color module in bartik
 $palette = array(
