Fixed bug with filter code