more tests and bugfixes