Adapted to API changes