add helper function dof_levels
Small bug