Fix Exceptions must be old-style classes or derived from BaseException, not NoneType #4388