* Applied patch from Andreas Persson and made a few other small changes to fix a bug in the filter code.