More fixes and more tests