Fixes to filter and search function