switched to atexit