Some fixes and more tests