fix bugs in check-pid