Fix deprecation warnings and test failures

@ltk