fix bugs in the interaction between subclasses and external class/c contracts