Fix some deprecated APIs