Fixes some Python 3 AttributeErrors