Fixed a bug in filtering