fixed bugs on the out-filter function