Fixed conditional stripping of search elements