some more tests and bug fixes