Add heuristic to process upgrade chains.
Remove compiler warning.
Fix upgrade chain processing heuristic.