diff --git a/matlab/hess_element.m b/matlab/hess_element.m
index 8bf24a5b966a6e120fe0de72bda45c0031052523..176919e717a36fa835cf7cf7817b5b2755142b0f 100644
--- a/matlab/hess_element.m
+++ b/matlab/hess_element.m
@@ -3,7 +3,7 @@ function d=hess_element(func,element1,element2,args)
 % returns an entry of the finite differences approximation to the hessian of func
 %
 % INPUTS
-%    func       [function handle]  associated with the function
+%    func       [function name]    string with name of the function
 %    element1   [int]              the indices showing the element within the hessian that should be returned
 %    element2   [int]
 %    args       [cell array]       arguments provided to func
@@ -31,6 +31,8 @@ function d=hess_element(func,element1,element2,args)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+func = str2func(func);
+
 h=10e-6;
 p10 = args;
 p01 = args;
diff --git a/matlab/jacob_element.m b/matlab/jacob_element.m
index 5876a2b895c9c8ad102d8c0088323de0f9872f4a..83bbbf1d0f6e727dc5e06f9a87ba2797714ebbbf 100644
--- a/matlab/jacob_element.m
+++ b/matlab/jacob_element.m
@@ -3,7 +3,7 @@ function d=jacob_element(func,element,args)
 % returns an entry of the finite differences approximation to the jacobian of func
 %
 % INPUTS
-%    func       [function handle]  associated with the function
+%    func       [function name]    string with name of the function
 %    element    [int]              the index showing the element within the jacobian that should be returned
 %    args       [cell array]       arguments provided to func
 %
@@ -30,6 +30,8 @@ function d=jacob_element(func,element,args)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+func = str2func(func);
+
 h=10e-6;
 pargs=args;
 margs=args;
diff --git a/preprocessor/ExprNode.cc b/preprocessor/ExprNode.cc
index e927e1fb36f35e0d86bb1e17110020490a2d31ef..861f479ce22da03bdbfe93b0feb479955f57e5af 100644
--- a/preprocessor/ExprNode.cc
+++ b/preprocessor/ExprNode.cc
@@ -3963,8 +3963,8 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
       if (first_deriv_symb_id == symb_id)
         return;
       else if (first_deriv_symb_id == eExtFunNotSet)
-        output << "TEFD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << " = jacob_element(@"
-               << datatree.symbol_table.getName(symb_id) << "," << inputIndex << ",{";
+        output << "TEFD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << " = jacob_element('"
+               << datatree.symbol_table.getName(symb_id) << "'," << inputIndex << ",{";
       else
         {
           tef_terms[make_pair(first_deriv_symb_id, arguments)] = (int) tef_terms.size();
@@ -4065,7 +4065,7 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
         return;
       else if (second_deriv_symb_id == eExtFunNotSet)
         output << "TEFDD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2
-               << " = hess_element(@" << datatree.symbol_table.getName(symb_id) << ","
+               << " = hess_element('" << datatree.symbol_table.getName(symb_id) << "',"
                << inputIndex1 << "," << inputIndex2 << ",{";
       else
         {