intervals and sets: added some tests and fixed some bugs