fix bug in filter()