Fix many deprecation warnings