fix minor bugs in filtering