Fixed "zero-distance" bug and a typo