A few optimizations and fixes for BigInt type.