Patch to remove segfault on the exiting of a service.