More robust integer check.