fix filtering bugs