Modified argument validation checks to avoid integer overflows