Fix most deprecation warnings