prevent segfault on termination