diff --git a/include/hpp/manipulation/graph/edge.hh b/include/hpp/manipulation/graph/edge.hh
index 43172d2750569ef9412b103f7d8f658e2f47769d..4a1cc5bf582fd7fdabf34f8b19fb5c4200816479 100644
--- a/include/hpp/manipulation/graph/edge.hh
+++ b/include/hpp/manipulation/graph/edge.hh
@@ -238,10 +238,8 @@ namespace hpp {
 
           virtual bool applyConstraints (ConfigurationIn_t qoffset, ConfigurationOut_t q) const;
 
-          /// Return the inner waypoint.
-          /// \param EdgeType is either Edge or WaypointEdge
-          template <class EdgeType>
-          boost::shared_ptr <EdgeType> waypoint (const std::size_t index) const;
+          /// Return the index-th edge.
+          const EdgePtr_t& waypoint (const std::size_t index) const;
 
           /// Print the object in a stream.
           virtual std::ostream& dotPrint (std::ostream& os, dot::DrawingAttributes da = dot::DrawingAttributes ()) const;
diff --git a/src/graph/edge.cc b/src/graph/edge.cc
index ebad3265bddb67ab6176ed1804dabf836d761b00..edfa06bb249c8086e2c42470d941c3f2fa5c05a5 100644
--- a/src/graph/edge.cc
+++ b/src/graph/edge.cc
@@ -403,20 +403,12 @@ namespace hpp {
         edges_[index] = wEdge;
       }
 
-      template <>
-      EdgePtr_t WaypointEdge::waypoint <Edge> (const std::size_t index) const
+      const EdgePtr_t& WaypointEdge::waypoint (const std::size_t index) const
       {
         assert (index < edges_.size()); 
         return edges_[index];
       }
 
-      template <>
-      WaypointEdgePtr_t WaypointEdge::waypoint <WaypointEdge> (const std::size_t index) const
-      {
-        assert (index < edges_.size()); 
-        return HPP_DYNAMIC_PTR_CAST (WaypointEdge, edges_[index]);
-      }
-
       std::ostream& WaypointEdge::print (std::ostream& os) const
       {
         os << "|   |   |-- ";