fixed various bugs in ClassMetadata (mostly taken from DCOM-96) and resulting exposed issues in the tests