capture KeyError + Patch for pid check/delete