Fix deprecations - upgrade to the latest API