fixed bug in createFilter function