Added extensive tests for collections, fixed bug in TypeCollection.