more tests and fixed bug