diff --git a/.gitignore b/.gitignore
index 91ea4571fb5bdd8b6b01d4a12ca325eab44cc37f..89a563ee7af31a527387de5f0eea14316bbf31b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
 *~
 *.orig
 *.ipynb_checkpoints
-build/*
+build*/*
 *.aux
 *.log
 *.pdf
diff --git a/include/crocoddyl/core/action-base.hpp b/include/crocoddyl/core/action-base.hpp
index 07cf9ff3ab9dafa90e9da9ebc0d7de9472c77047..2909018454c6fae93a6c225ded2b620fb59e0a61 100644
--- a/include/crocoddyl/core/action-base.hpp
+++ b/include/crocoddyl/core/action-base.hpp
@@ -41,10 +41,10 @@ class ActionModelAbstract {
   StateAbstract& get_state() const;
 
  protected:
-  unsigned int nu_;
-  unsigned int nr_;
-  StateAbstract& state_;
-  Eigen::VectorXd unone_;
+  unsigned int nu_; //!< Control dimension
+  unsigned int nr_; //!< Dimension of the cost residual
+  StateAbstract& state_; //!< Model of the state
+  Eigen::VectorXd unone_; //!< Neutral state
 
 #ifdef PYTHON_BINDINGS
 
@@ -90,6 +90,7 @@ struct ActionDataAbstract {
   template <typename Model>
   explicit ActionDataAbstract(Model* const model)
       : cost(0.),
+        costResidual(model->get_nr()),
         xnext(model->get_state().get_nx()),
         r(model->get_nr()),
         Fx(model->get_state().get_ndx(), model->get_state().get_ndx()),
@@ -122,6 +123,7 @@ struct ActionDataAbstract {
   const Eigen::MatrixXd& get_Fu() const { return Fu; }
 
   double cost;
+  Eigen::VectorXd costResidual;
   Eigen::VectorXd xnext;
   Eigen::VectorXd r;
   Eigen::MatrixXd Fx;
diff --git a/include/crocoddyl/core/numdiff/action.hpp b/include/crocoddyl/core/numdiff/action.hpp
index 5f71cd007d91c6be943bd019f76130805bb86479..0a61f3db83146759487164128ed4e2ef794920bb 100644
--- a/include/crocoddyl/core/numdiff/action.hpp
+++ b/include/crocoddyl/core/numdiff/action.hpp
@@ -22,6 +22,14 @@ class ActionModelNumDiff : public ActionModelAbstract {
 
   void calc(const boost::shared_ptr<ActionDataAbstract>& data, const Eigen::Ref<const Eigen::VectorXd>& x,
             const Eigen::Ref<const Eigen::VectorXd>& u);
+  /**
+   * @brief calcDiff computes the 
+   * 
+   * @param data 
+   * @param x 
+   * @param u 
+   * @param recalc 
+   */
   void calcDiff(const boost::shared_ptr<ActionDataAbstract>& data, const Eigen::Ref<const Eigen::VectorXd>& x,
                 const Eigen::Ref<const Eigen::VectorXd>& u, const bool& recalc = true);
   boost::shared_ptr<ActionDataAbstract> createData();
@@ -83,7 +91,7 @@ struct ActionDataNumDiff : public ActionDataAbstract {
     }
   }
 
-  Eigen::MatrixXd Rx;
+  Eigen::MatrixXd Rx; //!< Cost Jacobian: 
   Eigen::MatrixXd Ru;
   Eigen::VectorXd dx;
   Eigen::VectorXd du;
diff --git a/src/core/numdiff/action.cpp b/src/core/numdiff/action.cpp
index afffde41f92fe58841eb0281b3e53ca49e19dca1..756d3c32c9e6c19d5f9ac3063afd6efd43af4369 100644
--- a/src/core/numdiff/action.cpp
+++ b/src/core/numdiff/action.cpp
@@ -84,6 +84,13 @@ void ActionModelNumDiff::calcDiff(const boost::shared_ptr<ActionDataAbstract>& d
     data->Lxu = data_nd->Rx.transpose() * data_nd->Ru;
     data->Luu = data_nd->Ru.transpose() * data_nd->Ru;
   }
+  else
+  {
+    data->Lxx.fill(0.0);
+    data->Lxu.fill(0.0);
+    data->Luu.fill(0.0);
+  }
+  
 }
 
 ActionModelAbstract& ActionModelNumDiff::get_model() const { return model_; }