fixed filter bugs, code improvements