[misc] Replace call to deprecated method (and fix the build).