fixed cbirrt distance check to avoid endless loops