diff --git a/src/dm/impls/plex/plex.c b/src/dm/impls/plex/plex.c
index 805fc6950e08596c4fff226c3111f2030033c11b..857d0d7826fd023ab64b47930613947bf860df57 100644
--- a/src/dm/impls/plex/plex.c
+++ b/src/dm/impls/plex/plex.c
@@ -8454,6 +8454,7 @@ static PetscErrorCode DMPlexCreateConstraintMatrix_Anchors(DM dm, PetscSection s
     }
     else {
       annz = 0;
+      ierr = PetscSectionGetDof(cSec,p,&dof);CHKERRQ(ierr);
       for (q = 0; q < dof; q++) {
         a = anchors[off + q];
         ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr);
