added some fixes and more tests