bugfix: max_dist wasn't being used