Improve superclass handling

Fixes #965