rewrite the is_subclass_of2 function