Some more tests and fixes