fix filtering functionality