fixed dist function