bugfix and more tests