Improve validation of numeric input

Reject input with non-numeric characters.