diff --git a/Solver/function.cpp b/Solver/function.cpp
index 57beb24cbb95d62238f6149ef6b0c586afc8b8a8..aadd3c0699dcaa41a3852188ed4074aadc17b99b 100644
--- a/Solver/function.cpp
+++ b/Solver/function.cpp
@@ -66,7 +66,7 @@ dataCacheDouble::dataCacheDouble(dataCacheMap *m, function *f):
     _dependencies[i] = &m->getSecondaryCache(iCache)->get(f,this);
   }
   for (int i = 0; i < f->_functionReplaces.size(); i++) {
-    functionReplaceCaches.push_back (new functionReplaceCache(m, f->_functionReplaces[i])); 
+    functionReplaceCaches.push_back (new functionReplaceCache(m, f->_functionReplaces[i], this)); 
   }
 }
 
@@ -504,7 +504,7 @@ void functionReplace::compute(){
 };
 
 
-functionReplaceCache::functionReplaceCache(dataCacheMap *m, functionReplace *rep) {
+functionReplaceCache::functionReplaceCache(dataCacheMap *m, functionReplace *rep, dataCacheDouble *from) {
   map = m->newChild();
   for (int i = 0; i < m->_secondaryCaches.size(); i ++) {
     map->addSecondaryCache (m->getSecondaryCache(i+1)->newChild());
@@ -514,7 +514,7 @@ functionReplaceCache::functionReplaceCache(dataCacheMap *m, functionReplace *rep
   }
   for (int i = 0; i < rep->_toCompute.size(); i++) {
     dataCacheMap *m2 = map->getSecondaryCache(rep->_toCompute[i].iMap);
-    toCompute.push_back (&m2->get(rep->_toCompute[i].f));
+    toCompute.push_back (&m2->get(rep->_toCompute[i].f, from));
   }
 }
 functionReplaceCache::~functionReplaceCache() {
diff --git a/Solver/function.h b/Solver/function.h
index 7c4d318f646fd36f857c5a145b100d2168676a53..91188faf2c68722d37fc689949b8858b2d891d5d 100644
--- a/Solver/function.h
+++ b/Solver/function.h
@@ -81,6 +81,7 @@ class function {
 // then the size of the matrix is automatically adjusted
 class dataCacheDouble {
   friend class dataCacheMap;
+  public:
   // pointers to all of the dataCache depending on me
   std::set<dataCacheDouble*> _dependOnMe;
   std::set<dataCacheDouble*> _iDependOn;
@@ -238,7 +239,7 @@ class functionReplaceCache {
   dataCacheMap *map;
   std::vector <dataCacheDouble*> toReplace;
   std::vector <dataCacheDouble*> toCompute;
-  functionReplaceCache(dataCacheMap *m, functionReplace *rep);
+  functionReplaceCache(dataCacheMap *m, functionReplace *rep, dataCacheDouble *from);
   ~functionReplaceCache();
 };