made writing the nc only on rank 0