added some tests (and found a bug thanks to that)