added a few fixes to netCDF file generation.