enhance code ns: filter

optimize and bugfix