2.x, 3.x compatible way to check if number