Add bug fixes and tests for filters