Repair broken parent link in the scanner - stable6

backport of #8968 

cc @PVince81 @ser72 @karlitschek @craigpg