Adapt to latest API changes