Adapt to latest API