Fixing deprecated code