changed double to BigDecimal, small bugfixes