diff --git a/src/avalanche/gistools/gridfile.C b/src/avalanche/gistools/gridfile.C
index a6e59b270729e62f8b74023d29b29b9464d0e52a..de9bff6881b100a655c3b22ff54a9f870fee4b9e 100644
--- a/src/avalanche/gistools/gridfile.C
+++ b/src/avalanche/gistools/gridfile.C
@@ -295,11 +295,10 @@ int gridfile::write(const std::string& fname)
         return 0;
     }
 
-    pFile << "xllcenter " << this->xllcenter_ << std::endl
-          << "yllcenter " << this->yllcenter_ << std::endl
+    pFile << "ncols " << this->ncols_ << std::endl
           << "nrows " << this->nrows_ << std::endl
-          << "ncols " << this->ncols_ << std::endl
-          << "NODATA_value " << this->NODATA_value_ << std::endl;
+          << "xllcenter " << this->xllcenter_ << std::endl
+          << "yllcenter " << this->yllcenter_ << std::endl;
 
     if (this->dx_ == this->dy_)
     {
@@ -311,6 +310,8 @@ int gridfile::write(const std::string& fname)
               << "dy " << dy_ << std::endl;
     }
 
+    pFile << "NODATA_value " << this->NODATA_value_ << std::endl;
+
     for (unsigned int j=0; j<this->nrows_; j++)
     {
         for (unsigned int i=0; i<this->ncols_; i++)