fix bugs, filter almost done