Improved checking of subclasses