diff --git a/regtest/analysis/rt-histo-read/Makefile b/regtest/analysis/rt-histo-read/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3703b27cea227aa053fb6d1d73f861e4384dbcee
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/Makefile
@@ -0,0 +1 @@
+include ../../scripts/test.make
diff --git a/regtest/analysis/rt-histo-read/analysis.0.histoA1.reference b/regtest/analysis/rt-histo-read/analysis.0.histoA1.reference
new file mode 100644
index 0000000000000000000000000000000000000000..dac7092f9073a4537416b037a9831042e8e956ac
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/analysis.0.histoA1.reference
@@ -0,0 +1,107 @@
+#! FIELDS x hA1 dhA1_x
+#! SET normalisation    1.0000
+#! SET min_x 0.0
+#! SET max_x 3.0
+#! SET nbins_x  100
+#! SET periodic_x false
+   0.0000 195281.5510 1171689.3059
+   0.0300 233374.0120 1372239.1906
+   0.0600 277894.7287 1600673.6375
+   0.0900 329719.5249 1859618.1202
+   0.1200 389803.3450 2151714.4644
+   0.1500 459180.0360 2479572.1942
+   0.1800 538960.5453 2845711.6791
+   0.2100 630329.2919 3252499.1462
+   0.2400 734538.4688 3702073.8827
+   0.2700 852900.0521 4196268.2562
+   0.3000 986775.3142 4736521.5084
+   0.3300 1137561.6741 5323788.6349
+   0.3600 1306676.7597 5958446.0244
+   0.3900 1495539.6168 6640195.8985
+   0.4200 1705549.0620 7367971.9478
+   0.4500 1938059.2570 8139848.8796
+   0.4800 2194352.6646 8952958.8714
+   0.5100 2475610.6414 9803418.1400
+   0.5400 2782882.0224 10686266.9658
+   0.5700 3117050.1486 11595426.5527
+   0.6000 3478798.8960 12523676.0257
+   0.6300 3868578.3549 13462652.6750
+   0.6600 4286570.9004 14402878.2253
+   0.6900 4732658.4718 15333813.4486
+   0.7200 5206391.9371 16243942.8438
+   0.7500 5706963.4630 17120890.3889
+   0.7800 6233182.8263 17951566.5398
+   0.8100 6783458.5967 18722345.7268
+   0.8400 7355785.0803 19419272.6120
+   0.8700 7947735.8502 20028294.3426
+   0.9000 8556464.5878 20535515.0106
+   0.9300 9178713.8322 20927467.5374
+   0.9600 9810832.0784 21191397.2894
+   0.9900 10448799.4787 21315550.9366
+   1.0200 11088262.2004 21289463.4248
+   1.0500 11724575.2703 21104235.4865
+   1.0800 12352853.5046 20752793.8878
+   1.1100 12968029.8907 20230126.6295
+   1.1400 13564920.5538 19533485.5975
+   1.1700 14138295.2277 18662549.7006
+   1.2000 14682951.9486 17619542.3384
+   1.2300 15193794.5224 16409298.0842
+   1.2600 15665911.1810 15039274.7338
+   1.2900 16094652.7483 13519508.3086
+   1.3200 16475708.5886 11862510.1838
+   1.3500 16805178.6081 10083107.1649
+   1.3800 17079639.6334 8198227.0240
+   1.4100 17296204.5868 6226633.6513
+   1.4400 17452573.0306 4188617.5274
+   1.4700 17547071.8422 2105648.6211
+   1.5000 17578685.0148   0.0000
+   1.5300 17547071.8422 -2105648.6211
+   1.5600 17452573.0306 -4188617.5274
+   1.5900 17296204.5868 -6226633.6513
+   1.6200 17079639.6334 -8198227.0240
+   1.6500 16805178.6081 -10083107.1649
+   1.6800 16475708.5886 -11862510.1838
+   1.7100 16094652.7483 -13519508.3086
+   1.7400 15665911.1810 -15039274.7338
+   1.7700 15193794.5224 -16409298.0842
+   1.8000 14682951.9486 -17619542.3384
+   1.8300 14138295.2277 -18662549.7006
+   1.8600 13564920.5538 -19533485.5975
+   1.8900 12968029.8907 -20230126.6295
+   1.9200 12352853.5046 -20752793.8878
+   1.9500 11724575.2703 -21104235.4865
+   1.9800 11088262.2004 -21289463.4248
+   2.0100 10448799.4787 -21315550.9366
+   2.0400 9810832.0784 -21191397.2894
+   2.0700 9178713.8322 -20927467.5374
+   2.1000 8556464.5878 -20535515.0106
+   2.1300 7947735.8502 -20028294.3426
+   2.1600 7355785.0803 -19419272.6120
+   2.1900 6783458.5967 -18722345.7268
+   2.2200 6233182.8263 -17951566.5398
+   2.2500 5706963.4630 -17120890.3889
+   2.2800 5206391.9371 -16243942.8438
+   2.3100 4732658.4718 -15333813.4486
+   2.3400 4286570.9004 -14402878.2253
+   2.3700 3868578.3549 -13462652.6750
+   2.4000 3478798.8960 -12523676.0257
+   2.4300 3117050.1486 -11595426.5527
+   2.4600 2782882.0224 -10686266.9658
+   2.4900 2475610.6414 -9803418.1400
+   2.5200 2194352.6646 -8952958.8714
+   2.5500 1938059.2570 -8139848.8796
+   2.5800 1705549.0620 -7367971.9478
+   2.6100 1495539.6168 -6640195.8985
+   2.6400 1306676.7597 -5958446.0244
+   2.6700 1137561.6741 -5323788.6349
+   2.7000 986775.3142 -4736521.5084
+   2.7300 852900.0521 -4196268.2562
+   2.7600 734538.4688 -3702073.8827
+   2.7900 630329.2919 -3252499.1462
+   2.8200 538960.5453 -2845711.6791
+   2.8500 459180.0360 -2479572.1942
+   2.8800 389803.3450 -2151714.4644
+   2.9100 329719.5249 -1859618.1202
+   2.9400 277894.7287 -1600673.6375
+   2.9700 233374.0120 -1372239.1906
+   3.0000 195281.5510 -1171689.3059
diff --git a/regtest/analysis/rt-histo-read/config b/regtest/analysis/rt-histo-read/config
new file mode 100644
index 0000000000000000000000000000000000000000..f93ec1a97465724691bf162d4735f5ea3648bbb4
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/config
@@ -0,0 +1,3 @@
+type=driver
+# this is to test a different name
+arg="--plumed plumed.dat --ixyz trajectory.xyz"
diff --git a/regtest/analysis/rt-histo-read/plumed.dat b/regtest/analysis/rt-histo-read/plumed.dat
new file mode 100755
index 0000000000000000000000000000000000000000..ad543599ec5cacb21d1905a64c1d9b3f679e36ef
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/plumed.dat
@@ -0,0 +1,14 @@
+x: DISTANCE ATOMS=1,2
+w: READ FILE=weights.dat VALUES=w IGNORE_TIME 
+
+HISTOGRAM ...
+  ARG=x
+  GRID_MIN=0.0
+  GRID_MAX=3.0
+  GRID_BIN=100
+  LOGWEIGHTS=w
+  BANDWIDTH=0.5
+  LABEL=hA1
+... HISTOGRAM
+
+DUMPGRID GRID=hA1 FILE=histoA1 STRIDE=1 FMT=%8.4f
diff --git a/regtest/analysis/rt-histo-read/trajectory.xyz b/regtest/analysis/rt-histo-read/trajectory.xyz
new file mode 100644
index 0000000000000000000000000000000000000000..c910ae5c6fda2241cfe5be857f9b8493db430ed3
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/trajectory.xyz
@@ -0,0 +1,12 @@
+2
+0 0 0
+X 0 0 0
+X 0 0 1
+2
+0 0 0
+X 0 0 0
+X 0 0 1.5
+2
+0 0 0
+X 0 0 0
+X 0 0 2
diff --git a/regtest/analysis/rt-histo-read/weights.dat b/regtest/analysis/rt-histo-read/weights.dat
new file mode 100644
index 0000000000000000000000000000000000000000..03edd47705ea23c2706982c6f7d09b06fcccb676
--- /dev/null
+++ b/regtest/analysis/rt-histo-read/weights.dat
@@ -0,0 +1,4 @@
+#! FIELDS time w
+ 0.000000 19.643847
+ 0.500000 16.907989
+ 1.000000 18.127072
diff --git a/src/vesselbase/ActionWithAveraging.cpp b/src/vesselbase/ActionWithAveraging.cpp
index 9ba90f0e78f2c459ea1cb3bb69831bc0011938fc..c6aee46fe63aa5e1c46bc0df6c1bbdf883eb759c 100644
--- a/src/vesselbase/ActionWithAveraging.cpp
+++ b/src/vesselbase/ActionWithAveraging.cpp
@@ -82,7 +82,7 @@ ActionWithAveraging::ActionWithAveraging( const ActionOptions& ao ):
       ActionWithValue* val = plumed.getActionSet().selectWithLabel<ActionWithValue*>(wwstr[i]);
       if( !val ) error("could not find value named");
       bias::ReweightBase* iswham=dynamic_cast<bias::ReweightBase*>( val );
-      if( iswham->buildsWeightStore() ) error("to use wham you must gather data using COLLECT_FRAMES");
+      if( iswham && iswham->buildsWeightStore() ) error("to use wham you must gather data using COLLECT_FRAMES");
       weights.push_back( val->copyOutput(val->getLabel()) );
       arg.push_back( val->copyOutput(val->getLabel()) );
       log.printf("%s ",wwstr[i].c_str() );