fixed a bug in filtering