cleaning try-exept in write_ncc