Fixed a warning and calls to a removed API.