Patches to support proper cleanup of running processes