Some changes for bug #8161.