improve validation for integers

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>