Avoiding division by zero in kolmogorov algorithm