added some tests, fixed some wrong behaviours