Fix conversion of BigDecimal to Long