fix comparison to accept 0 distance results in distance table