Use explicit cast to avoid compiler signedness warning.
Catch dof as dof_id_type.