Fix deprecated code