diff --git a/pub/lib/olf.cpp b/pub/lib/olf.cpp
index 3197b88b621ad0ade1d324b30718ad088c923425..5400aa6716ce16ecc6527cd6963631a16ed1414b 100644
--- a/pub/lib/olf.cpp
+++ b/pub/lib/olf.cpp
@@ -733,14 +733,14 @@ string COlc::weight_str() const
 //*  namespace NOlo - service functions
 //**************************************************************************************************
 
-int NOlo::j2j(const POlo fin, int jin, const POlo fout )
+int NOlo::j2j(const COlo* fin, int jin, const COlo* fout )
 {
-    if (j >= fin->nJ())
+    if (jin >= fin->nJ())
         throw S("BUG: NOlo::j2j called with invalid j");
     if (fout->nJ() == 1) // nJ:1  correspondence
         return 0;
     else if (fout->nJ() == fin->nJ()) // nJ:nJ correspondence
-        return j;
+        return jin;
     else
         throw S("Wrong file correspondence: number of spectra does not match");
 }
diff --git a/pub/lib/olf.hpp b/pub/lib/olf.hpp
index ed2b24d904059939240150f493e003227663c2eb..e343cb38ed3a9ddf9a61dbd503c0ee88489a7cef 100644
--- a/pub/lib/olf.hpp
+++ b/pub/lib/olf.hpp
@@ -168,7 +168,7 @@ public:
 //! Service functions for online objects.
 
 namespace NOlo {
-    int j2j(const POlo fin, int jin, const POlo fout );
+    int j2j(const COlo* fin, int jin, const COlo* fout );
 } // namespace NOlo