Merge "Delete local references to avoid reference table overflow." into kraken