fix euclidian distance ;-) and make sure we use double for the costs