fixes to the type of the filter function