Fix a type warning.
Replace a deprecated method.