Adapt to updated API