diff --git a/src/graph-path-validation.cc b/src/graph-path-validation.cc
index 710b16c9b2d44619abec1dc34061a5836228e8a9..080e2087f5e6031a91d9ff1d169dbb868d638545 100644
--- a/src/graph-path-validation.cc
+++ b/src/graph-path-validation.cc
@@ -21,6 +21,7 @@
 #include <hpp/core/path.hh>
 #include <hpp/core/path-vector.hh>
 
+#include <hpp/manipulation/graph/state.hh>
 #include <hpp/manipulation/graph/edge.hh>
 #include <hpp/manipulation/graph/graph.hh>
 #include <hpp/manipulation/constraint-set.hh>
diff --git a/src/graph/helper.cc b/src/graph/helper.cc
index a9132c9bd7f02405ee43f4eda55ecf4d28a55505..815edbc2a531260787f91c4411c0736fd6aeda11 100644
--- a/src/graph/helper.cc
+++ b/src/graph/helper.cc
@@ -1102,7 +1102,7 @@ namespace hpp {
             // Create object lock
 	    // Loop over all frames of object, detect joint and create locked
 	    // joint.
-            assert (robot.frameIndices.has (od.name));
+            assert (robot.robotFrames (od.name).size () != 0);
             BOOST_FOREACH (const FrameIndex& f, robot.robotFrames (od.name)) {
               if (model.frames[f].type != ::pinocchio::JOINT) continue;
               const JointIndex j = model.frames[f].parent;