working on termination (atexit)