Change the calculation of the bottom and top dofs.