Added protection against errors in subclassing.