checking for broken target spans, bails out if stack blows up, writes a log file