Fix deprecated method warning