diff --git a/src/bias/PBMetaD.cpp b/src/bias/PBMetaD.cpp
index 64e8f8e3a2c07a030eb1bf256d6bb12f230110e6..66ae2e20a4830a0cc7261f4ec65cb485fc2fb0f9 100644
--- a/src/bias/PBMetaD.cpp
+++ b/src/bias/PBMetaD.cpp
@@ -253,8 +253,8 @@ void PBMetaD::registerKeywords(Keywords& keys){
 }
 
 PBMetaD::~PBMetaD(){
-  for(int i=0; i<BiasGrids_.size();   ++i) delete BiasGrids_[i];
-  for(int i=0; i<hillsOfiles_.size(); ++i){
+  for(unsigned i=0; i<BiasGrids_.size();   ++i) delete BiasGrids_[i];
+  for(unsigned i=0; i<hillsOfiles_.size(); ++i){
    hillsOfiles_[i]->close();
    delete hillsOfiles_[i];
   }
@@ -262,8 +262,8 @@ PBMetaD::~PBMetaD(){
 
 PBMetaD::PBMetaD(const ActionOptions& ao):
 PLUMED_BIAS_INIT(ao),
-height0_(std::numeric_limits<double>::max()), biasf_(1.0), kbt_(0.0),
-grid_(false), stride_(0), welltemp_(false),
+grid_(false), height0_(std::numeric_limits<double>::max()),
+biasf_(1.0), kbt_(0.0), stride_(0), welltemp_(false),
 multiple_w(false), doInt_(false), isFirstStep(true)
 {
 
@@ -428,7 +428,7 @@ multiple_w(false), doInt_(false), isFirstStep(true)
   }
 
 // read Gaussians if restarting
-  for(int i=0;i<hillsfname.size();++i){
+  for(unsigned i=0;i<hillsfname.size();++i){
    IFile *ifile = new IFile();
    ifile->link(*this);
    if(ifile->FileExist(hillsfname[i])){
@@ -443,8 +443,19 @@ multiple_w(false), doInt_(false), isFirstStep(true)
    }
   }
 
+  comm.Barrier();
+
+// this barrier is needed when using walkers_mpi
+// to be sure that all files have been read before
+// backing them up
+// it should not be used when walkers_mpi is false otherwise
+// it would introduce troubles when using replicas without METAD
+// (e.g. in bias exchange with a neutral replica)
+// see issue #168 on github
+  if(comm.Get_rank()==0 && multiple_w) multi_sim_comm.Barrier();
+
 // open hills files for writing
- for(int i=0;i<hillsfname.size();++i){
+ for(unsigned i=0;i<hillsfname.size();++i){
   OFile *ofile = new OFile();
   ofile->link(*this);
   string hillsfname_tmp = hillsfname[i];