fixes bug in CompositeFilter.

Problem: ClassCastException in some cases

Solution:
Adding an instance of check at the appropriate place.

Notes:
There may remain an issue with the SUBSTRACTION case.