more robust integer overflow check
Merge branch '21-int-overflow' into 22