Fix errors and deprecation warnings

Was this a deprecation warning?