Remove some deprecated api usage from the code