Fix Attribute- and NameErrors (regression from 4b2eeee)
Fix DeprecationWarnings