*** src/loghmm.cpp	2016-03-08 13:25:32.000000000 +0100
--- src/loghmm.cpp	2017-05-10 23:50:33.867097035 +0200
***************
*** 159,165 ****
                  sum+=exp(this->logalpha[t-1][jN]+log(A[jN][iN])-temp);
              };
              this->logalpha[t][iN]=temp+log(sum)+this->logdensities[t][iN];
! if(isnan(this->logalpha[t][iN])){
  cout<<"logalpha["<<t<<"]["<<iN<<"]= "<<temp<<"+log("<<sum<<")+"<<logdensities[t][iN]<<endl;
  exit(1);
  };
--- 159,165 ----
                  sum+=exp(this->logalpha[t-1][jN]+log(A[jN][iN])-temp);
              };
              this->logalpha[t][iN]=temp+log(sum)+this->logdensities[t][iN];
! if(std::isnan(this->logalpha[t][iN])){
  cout<<"logalpha["<<t<<"]["<<iN<<"]= "<<temp<<"+log("<<sum<<")+"<<logdensities[t][iN]<<endl;
  exit(1);
  };
***************
*** 258,264 ****
          
          //CALCULATE THE LOGLIKELIHOOD
  		logPnew = this->logLikelihood();
! 		if(isnan(logPnew)) break;
          smallnumber = logPnew - logPold; /* fabs(logPnew - logPold); */
  //	cout<<"\t loglik = "<<logPnew<<endl;
          cout<<"************************************************************************************************ delta logP = " <<smallnumber<<"\n";
--- 258,264 ----
          
          //CALCULATE THE LOGLIKELIHOOD
  		logPnew = this->logLikelihood();
! 		if(std::isnan(logPnew)) break;
          smallnumber = logPnew - logPold; /* fabs(logPnew - logPold); */
  //	cout<<"\t loglik = "<<logPnew<<endl;
          cout<<"************************************************************************************************ delta logP = " <<smallnumber<<"\n";
***************
*** 492,498 ****
  
  		//CALCULATE THE LOGLIKELIHOOD
  		logPnew = this->logLikelihood();
! 		if(isnan(logPnew)) {cout<<"!!!!! loglik = "<<logPnew<<" ----> BREAK"<<endl; break;};
          smallnumber = logPnew - logPold; /* fabs(logPnew - logPold); */
  	cout<<"\t loglik = "<<logPnew<<endl;
          cout<<"************************************************************************************************ delta logP = " <<smallnumber<<"\n";
--- 492,498 ----
  
  		//CALCULATE THE LOGLIKELIHOOD
  		logPnew = this->logLikelihood();
! 		if(std::isnan(logPnew)) {cout<<"!!!!! loglik = "<<logPnew<<" ----> BREAK"<<endl; break;};
          smallnumber = logPnew - logPold; /* fabs(logPnew - logPold); */
  	cout<<"\t loglik = "<<logPnew<<endl;
          cout<<"************************************************************************************************ delta logP = " <<smallnumber<<"\n";
***************
*** 713,719 ****
                      ZiNB *d;
                      if(wID>0)
                      {
!                         if(isnan(loglikZN[wID-1]))
                              d = new ZiNB(model->O,1.5,0.15,wList[wID]);
                          else
                              d = new ZiNB(model->O,rListZN[wID-1][i],pListZN[wID-1][i],wList[wID]);
--- 713,719 ----
                      ZiNB *d;
                      if(wID>0)
                      {
!                         if(std::isnan(loglikZN[wID-1]))
                              d = new ZiNB(model->O,1.5,0.15,wList[wID]);
                          else
                              d = new ZiNB(model->O,rListZN[wID-1][i],pListZN[wID-1][i],wList[wID]);
***************
*** 728,734 ****
                      NegativeBinomial *d;
                      if(wID>0)
                      {
!                         if(isnan(loglikZN[wID-1]))
                              d = new NegativeBinomial(model->O,3.0,0.01);
                          else
                              d = new NegativeBinomial(model->O,rListZN[wID-1][i],pListZN[wID-1][i]);
--- 728,734 ----
                      NegativeBinomial *d;
                      if(wID>0)
                      {
!                         if(std::isnan(loglikZN[wID-1]))
                              d = new NegativeBinomial(model->O,3.0,0.01);
                          else
                              d = new NegativeBinomial(model->O,rListZN[wID-1][i],pListZN[wID-1][i]);
***************
*** 825,831 ****
                          ZiNB *d;
                          if(wID*maxNW+w2>0)
                          {
!                             if(isnan(loglikZZ[wID*maxNW+w2-1]))
                                  d = new ZiNB(model->O,1.5,0.15,wList[wID]);
                              else
                                  d = new ZiNB(model->O,rListZZ[wID*maxNW+w2-1][i],pListZZ[wID*maxNW+w2-1][i],wList[wID]);
--- 825,831 ----
                          ZiNB *d;
                          if(wID*maxNW+w2>0)
                          {
!                             if(std::isnan(loglikZZ[wID*maxNW+w2-1]))
                                  d = new ZiNB(model->O,1.5,0.15,wList[wID]);
                              else
                                  d = new ZiNB(model->O,rListZZ[wID*maxNW+w2-1][i],pListZZ[wID*maxNW+w2-1][i],wList[wID]);
***************
*** 839,845 ****
                          ZiNB *d;
                          if(wID*maxNW+w2>0)
                          {
!                             if(isnan(loglikZZ[wID*maxNW+w2-1]))
                                  d = new ZiNB(model->O,3.0,0.01,wList[w2]);
                              else
                                  d = new ZiNB(model->O,rListZZ[wID*maxNW+w2-1][i],pListZZ[wID*maxNW+w2-1][i],wList[w2]);
--- 839,845 ----
                          ZiNB *d;
                          if(wID*maxNW+w2>0)
                          {
!                             if(std::isnan(loglikZZ[wID*maxNW+w2-1]))
                                  d = new ZiNB(model->O,3.0,0.01,wList[w2]);
                              else
                                  d = new ZiNB(model->O,rListZZ[wID*maxNW+w2-1][i],pListZZ[wID*maxNW+w2-1][i],wList[w2]);
