Fix parseValue

fixes https://github.com/bitpay/bitcore/issues/443
fixes https://github.com/bitpay/bitcore/issues/516