stop erratic numbers?

do the digital inputs have pull-up resistors or internal pull-ups enabled - if not they will be floating which could explain it.