Adapted to API changes.