Upgrade deprecated code