Fix bugs and tests from some API changes.