fixed max-dist filter
removed debug lines