Fixing segfault on exit.