support the case dist==0