diff --git a/include/CheckForPDF.h b/include/CheckForPDF.h
index 913439ac6121ff9b17e269c6e23d93417fc82b71..992a7ace09d5aa8073a3f43ca22e86cd75eb2bd1 100644
--- a/include/CheckForPDF.h
+++ b/include/CheckForPDF.h
@@ -5,7 +5,7 @@
 #include <algorithm>
 
 
-void CheckForPDF(char *pdfname);
+void CheckForPDF(char const* pdfname);
 
 
 // for Fortran calling
diff --git a/src/CheckForPDF.cxx b/src/CheckForPDF.cxx
index 2ffdfc143f7e18529fc3d9adce4246bb7ac3f8f4..8c4fbb83672f72117b688af64231aa8acb8ba011 100644
--- a/src/CheckForPDF.cxx
+++ b/src/CheckForPDF.cxx
@@ -1,8 +1,9 @@
 #include "CheckForPDF.h"
 
+
 using namespace std;
 
-void CheckForPDF(char *pdfname){
+void CheckForPDF(char const*pdfname){
   bool found= false;
   string spdfname=string(pdfname);
   spdfname.erase(std::remove_if(spdfname.begin(), spdfname.end(), ::isspace),spdfname.end());
@@ -28,6 +29,9 @@ void CheckForPDF(char *pdfname){
 
 extern "C" {
   void checkforpdf_(char *pdfname, long int length){
-    CheckForPDF(pdfname);
+    char tmp[length];
+    memcpy(tmp,pdfname,length);
+    tmp[length] = '\0';
+    CheckForPDF(tmp);
   }
 }
diff --git a/src/rediagonalize.f b/src/rediagonalize.f
index f7cfc5b9e9247979accc9d76a53be150fa5ffd33..20132cfa1781bcd8cf05ea384924edf2db02f221 100644
--- a/src/rediagonalize.f
+++ b/src/rediagonalize.f
@@ -14,7 +14,7 @@ C#include "datasets.inc"
 #include "theo.inc"
 
       integer Ndata,NSyst
-      integer i,j,k,nsysloc
+      integer i,j,k,nsysloc, ifail
       double precision theo_err2_loc(Ndata)
       double precision Eigenvalues(Nsyst)  
       double precision RotBeta(Nsyst,Ndata)  ! dynamic 
@@ -61,7 +61,7 @@ c         print *,'ho',sqrt(theo_err2_loc(k))
          enddo
       enddo
 
-      call MyDSYEVD(Nsyst,Cov,NTot,Eigenvalues)
+      call MyDSYEVD(Nsyst,Cov,NTot,Eigenvalues,ifail)
 
       print '(''Eigenvalues:'')'
       do i=nsyst,1,-1
@@ -116,6 +116,5 @@ c      print *,nsyst,nsysloc
 c      print *,nsyst,nsysloc      
 
       call WriteTheoryFiles(nsysloc,theo_fix,.true.)
-
 C-------------------------------------
       end