add div flag, and atexit fn