Fixed the segv on process termination