more fixes and more tests