Replace calls to deprecated apis.