fixed rounding error
fixing manhattan distance with a random tie breaker