Fix various bugs in API changes.