Replace deprecated API usage with new ones.