Bugsfix and more tests