Added checks to writeTo*Digits()