fix include/exclude bugs and add more tests

I'll make some comment on the mailing list