Brought in changes from master, which in turn were brought in from the
fix-testcases branch.