Fix some deprecations + leaks