Fix some deprecations and remove some unused vars