Modify applyFilterIndices function

Add code for skip NaN data