fix bug in filtering