Fix (val instanceof bignum) can't check for bignum instance
Replace (val instanceof bignum) by (typeof val.toNumber == "function" )