fixed a bug in filter/3