fixed a bug when validating class hierarchy