diff --git a/DataQuality/DataQualityUtils/DataQualityUtils/HanOutputFile.h b/DataQuality/DataQualityUtils/DataQualityUtils/HanOutputFile.h
index b952560ce644fd082dbc442882b9d2aebc0d0088..9a497a51d5c816cce827e2ecb0a429cd90bc1e47 100644
--- a/DataQuality/DataQualityUtils/DataQualityUtils/HanOutputFile.h
+++ b/DataQuality/DataQualityUtils/DataQualityUtils/HanOutputFile.h
@@ -73,6 +73,8 @@ public:
   /**
    * cnvsType: 1=pngOnly;2=jsonOnly;3=pngAndJson
    */
+  const static int GENERATE_PNG        = 1; // Make PNG with TImage
+  const static int GENERATE_JSON       = 2; // Make JSON
   virtual int  saveAllHistograms( std::string location, bool drawRefs, std::string run_min_LB,int cnvsType = 1);
   static bool containsDir(std::string dirname, std::string maindir);
 
diff --git a/DataQuality/DataQualityUtils/src/HanOutputFile.cxx b/DataQuality/DataQualityUtils/src/HanOutputFile.cxx
index f0b1565d1db18e2c97291b3ab642c87ea202b085..a6a57a1bdaef75490a1b3093b72d22c81cdf61f8 100644
--- a/DataQuality/DataQualityUtils/src/HanOutputFile.cxx
+++ b/DataQuality/DataQualityUtils/src/HanOutputFile.cxx
@@ -1524,7 +1524,8 @@ std::pair<std::string,std::string> HanOutputFile:: getHistogram( std::string nam
   }
 
 
-  std::string rv(x, y);
+  std::string rv;
+  if (cnvsType & GENERATE_PNG) { rv.assign(x, y); };
   std::pair<std::string,std::string>rvPair{rv,json};
 
   delete img;
@@ -2773,8 +2774,6 @@ writeToFile(std::string fname ,std::string content)
 void HanOutputFile::
 convertToGraphics(int cnvsType, TCanvas* myC,std::string &json, TImage *img,char **x, int *y)
 {
-    int GENERATE_PNG        = 1; // Make PNG with TImage
-    int GENERATE_JSON       = 2; // Make JSON
     if (cnvsType & GENERATE_PNG) 
     {
         if(img) getImageBuffer(img,myC,x,y);
@@ -2788,8 +2787,6 @@ convertToGraphics(int cnvsType, TCanvas* myC,std::string &json, TImage *img,char
 void HanOutputFile::
 convertToGraphics(int cnvsType, TCanvas* myC,std::string namePNG,std::string nameJSON)
 {
-    int GENERATE_PNG        = 1; // Make PNG with TImage
-    int GENERATE_JSON       = 2; // Make JSON
     if (cnvsType & GENERATE_PNG) 
     {
         myC->SaveAs(namePNG.c_str());
@@ -2804,9 +2801,6 @@ convertToGraphics(int cnvsType, TCanvas* myC,std::string namePNG,std::string nam
 bool HanOutputFile::
 saveFile(int cnvsType, std::string pngfName,std::string pngContent, std::string jsonfName, std::string jsonfContent)
 {
-    int GENERATE_PNG        = 1; // Make PNG with TImage
-    int GENERATE_JSON       = 2; // Make JSON
-
     bool png =false;
     bool json=false;
     if (cnvsType & GENERATE_PNG)