Index: trunk/BNC/src/bncrinex.cpp
===================================================================
--- trunk/BNC/src/bncrinex.cpp	(revision 10755)
+++ trunk/BNC/src/bncrinex.cpp	(revision 10757)
@@ -571,33 +571,44 @@
     for (unsigned ii = 0; ii < satObs._obs.size(); ii++) {
       const t_frqObs* frqObs = satObs._obs[ii];
+      // CODE
       if (frqObs->_codeValid) {
         QString type = 'C' + QString(frqObs->_rnxType2ch.c_str());
-        t_rnxObsFile::t_rnxObs rnxObs;
-        rnxObs.value = frqObs->_code;
-        rnxSat.obs[type] = rnxObs;
-      }
+        if (rnxSat.obs.contains(type)) {
+          t_rnxObsFile::t_rnxObs rnxObs;
+          rnxObs.value = frqObs->_code;
+          rnxSat.obs[type] = rnxObs;
+        }
+      }
+      // PHASE
       if (frqObs->_phaseValid) {
         QString type = 'L' + QString(frqObs->_rnxType2ch.c_str());
-        t_rnxObsFile::t_rnxObs rnxObs;
-        rnxObs.value = frqObs->_phase;
-        if (frqObs->_slip) {
-          rnxObs.lli |= 1;
+        if (rnxSat.obs.contains(type)) {
+          t_rnxObsFile::t_rnxObs rnxObs;
+          rnxObs.value = frqObs->_phase;
+          if (frqObs->_slip) {
+            rnxObs.lli |= 1;
+          }
+          rnxSat.obs[type] = rnxObs;
         }
-        rnxSat.obs[type] = rnxObs;
-      }
+      }
+      // DOPPLER
       if (frqObs->_dopplerValid) {
         QString type = 'D' + QString(frqObs->_rnxType2ch.c_str());
-        t_rnxObsFile::t_rnxObs rnxObs;
-        rnxObs.value = frqObs->_doppler;
-        rnxSat.obs[type] = rnxObs;
-      }
+        if (rnxSat.obs.contains(type)) {
+          t_rnxObsFile::t_rnxObs rnxObs;
+          rnxObs.value = frqObs->_doppler;
+          rnxSat.obs[type] = rnxObs;
+        }
+      }
+      // SNR
       if (frqObs->_snrValid) {
         QString type = 'S' + QString(frqObs->_rnxType2ch.c_str());
-        t_rnxObsFile::t_rnxObs rnxObs;
-        rnxObs.value = frqObs->_snr;
-        rnxSat.obs[type] = rnxObs;
-      }
-    }
-
+        if (rnxSat.obs.contains(type)) {
+          t_rnxObsFile::t_rnxObs rnxObs;
+          rnxObs.value = frqObs->_snr;
+          rnxSat.obs[type] = rnxObs;
+        }
+      }
+    }
 
     rnxEpo.rnxSat.push_back(rnxSat);
@@ -618,5 +629,5 @@
 void bncRinex::closeFile() {
 
-  if (_header.version() == 3) {
+  if (_header.version() >= 3) {
     _out << ">                              4  1" << endl;
     _out << "END OF FILE" << endl;
