make PIDs the same for active processes
better error handling