bug fix about minimumDistance