merged with changes in Savespatialunitgroup  for fixing SOLA-FAO ticket #316-317