Fix issues related to killing processes with crtl-c