bug fixes to filter.php