fix to filter function