errors in filter function