Fix calls to deprecated APIs