more tests and some fixes