Check filter before sort otherwise items are not added if they pas stem filter function