Correct bug in distances