tests and bugfixes