Added num_digits to utils.misc