bug fix (infinite loop in some rare cases when computing distances between two perfectly flat clouds) + typo/syntax fixes