Fixing deprecation errors when running tests