Fixing warning for deprecated method