added some more tests and fixed a bug