reorder setsid and kill