fix bug to compute distance with filter enabled