Fixed dist calc error