Added tests for TypeReferenceContainer and fixed found bugs.