diff --git a/src/ros_joint_state.cpp b/src/ros_joint_state.cpp
index 1ff7087182e5b3258486c862ec4ae4939f43a6cc..f35991075bf43fe987dd9d05fe3e0e8cef6b5161 100644
--- a/src/ros_joint_state.cpp
+++ b/src/ros_joint_state.cpp
@@ -38,7 +38,7 @@ namespace dynamicgraph
     namespace {
       void  buildJointNames (sensor_msgs::JointState& jointState, se3::Model* robot_model) {
 	int cnt = 0;
-	for (int i=1;i<robot_model->nbodies;i++) {
+	for (int i=1;i<robot_model->njoints;i++) {
 	  // Ignore anchors.
 	  if (se3::nv(robot_model->joints[i]) != 0) {
 	    // If we only have one dof, the dof name is the joint name.
@@ -86,7 +86,7 @@ namespace dynamicgraph
 	}
 
       se3::Model* robot_model = dynamic->m_model;
-      if (robot_model->nbodies == 1)
+      if (robot_model->njoints == 1)
 	{
 	  std::cerr << "no robot in the dynamic entity" << std::endl;
 	  return Value ();