add more tests and a fix