Adapting code to recent API changes