added pidcheck

added pidcheck to compensate for unwanted residual pid due a forced exit