add_pid now handles the case when the pid is already present