fix and add more tests