add unit tests for ICollections and add some bug fixes