add more tests and fixes