more tests and bugfix