add atexit() to run something after main