CLASS: fixed filter function, added some new tests