Merged fix for unit tests from the 4.2-dev branch.