add more tests - fix 2 bugs