more unit tests, more bugfixes