Fix casting issues in filters