add protection against stackoverflow in recursive parent process check