Fix exception when generating unexpected relative object class error msg