Fixing deprecated method warning