            continue;
          }
      }
-@@ -1064,13 +1067,13 @@
+@@ -1055,6 +1059,9 @@
+ 
+ #ifdef DEBUG
+   {
++    // std::cout << "next_free_dof=" << next_free_dof << std::endl
++    // 	      << "_n_SCALAR_dofs=" << _n_SCALAR_dofs << std::endl;
++
+     // Make sure we didn't miss any nodes
+     MeshTools::libmesh_assert_valid_procids<Node>(mesh);
+ 
+@@ -1064,13 +1071,13 @@
        {
  	Node *obj = *node_it;
  	libmesh_assert(obj);

 	    libmesh_assert_not_equal_to (first_dof, DofObject::invalid_id);
 	  }
       }
@@ -1717,6 +1715,8 @@
   STOP_LOG("dof_indices()", "DofMap");
 }
 

+	ncg = this->n_comp_group(s,vg),
+	vig = this->system_var_to_vg_var(s,vg,var);
+
+      // std::cout << "base_idx, var, vg, vig, ncg, comp="
+      // 		<< base_idx << " "
+      // 		<< var << " "
+      // 		<< vg << " "
+      // 		<< vig << " "
+      // 		<< ncg << " "
+      // 		<< comp << '\n';
+
+      return (base_idx + vig*ncg + comp);
+    }
 }
 
 
@@ -639,6 +786,87 @@
 }
 
 
