bug fix when applying spatial filter