Fixed a bug with the filter of the distance