fixed bug in filtering