diff --git a/matlab/get_lhs_and_rhs.m b/matlab/get_lhs_and_rhs.m
index 84df0bbfa393eb7ddd0126a2d875f2f48d5f54a7..c7100deb5773308aad599eb89db6f7ef68a0449a 100644
--- a/matlab/get_lhs_and_rhs.m
+++ b/matlab/get_lhs_and_rhs.m
@@ -42,9 +42,9 @@ end
 
 % Get the equation from the JSON output.
 if original
-    jsonfil = loadjson([DynareModel.fname '_original.json']);
+    jsonfil = loadjson([DynareModel.fname filesep() 'model' filesep() 'json' filesep() 'modfile-original.json']);
 else
-    jsonfil = loadjson([DynareModel.fname '.json']);
+    jsonfil = loadjson([DynareModel.fname filesep() 'model' filesep() 'json' filesep() 'modfile.json']));
 end
 jsonmod = jsonfil.model;
 jsoneqn = getEquationsByTags(jsonmod, 'name', eqname);