more tests and fixes