diff --git a/core/modules/forum/src/Form/Overview.php b/core/modules/forum/src/Form/Overview.php
index 24f5142..ae60a82 100644
--- a/core/modules/forum/src/Form/Overview.php
+++ b/core/modules/forum/src/Form/Overview.php
@@ -63,9 +63,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
     // Build base taxonomy term overview.
     $form = parent::buildForm($form, $form_state, $vocabulary);
 
+    $terms = $form_state->get('terms');
     foreach (Element::children($form['terms']) as $key) {
-      if (isset($form['terms'][$key]['#term'])) {
-        $term = $form['terms'][$key]['#term'];
+      if (isset($terms[$key])) {
+        $term = $terms[$key];
         $form['terms'][$key]['term']['#url'] = Url::fromRoute('forum.page', ['taxonomy_term' => $term->id()]);
         unset($form['terms'][$key]['operations']['#links']['delete']);
         $route_parameters = $form['terms'][$key]['operations']['#links']['edit']['url']->getRouteParameters();
diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index eebbacc..91c99f5 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -198,6 +198,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
         }
       }
     }
+    $form_state->set('terms', $current_page);
 
     $errors = $form_state->getErrors();
     $destination = $this->getDestinationArray();
@@ -212,8 +213,6 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
       ),
     );
     foreach ($current_page as $key => $term) {
-      /** @var $term \Drupal\Core\Entity\EntityInterface */
-      $form['terms'][$key]['#term'] = $term;
       $indentation = array();
       if (isset($term->depth) && $term->depth > 0) {
         $indentation = array(
@@ -409,11 +408,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       $term = $tree[$weight];
     }
 
+    $terms = $form_state->get('terms');
     // Renumber the current page weights and assign any new parents.
     $level_weights = array();
-    foreach ($form_state->getValue('terms') as $tid => $values) {
-      if (isset($form['terms'][$tid]['#term'])) {
-        $term = $form['terms'][$tid]['#term'];
+    foreach ($form_state->getValue('terms') as $key => $values) {
+      if (isset($terms[$key])) {
+        $term = $terms[$key];
         // Give terms at the root level a weight in sequence with terms on previous pages.
         if ($values['term']['parent'] == 0 && $term->getWeight() != $weight) {
           $term->setWeight($weight);
