Fix deprecation warnings, fix tests