fix potential segfault on exit.
Revert "fix potential segfault on exit."

This reverts commit 59503090d6a4edd1a7678c8be5eb1cd9be1c5f55.