fixes filter function