Filter function fix