Fixed isinstance() behavior for complex inheritance for both old-style and new-style classes