Fix errors and deprecations