adds tests, bunch of fixes in collections