Fix memory corruption due to bad coding in AdvancedPIDFind().