added stuff for reorg nc file, but some bug remains