Correct number of DOFs with constraints