updates to write_nc