Fixing clearFilter function's logic